Changeset 84
- Timestamp:
- 01/31/07 08:38:33 (5 years ago)
- Files:
-
- downloads/rulesplayer.zip (modified) (previous)
- downloads/rulessetup.exe (modified) (previous)
- trunk/setup/rulessetup.nsi (modified) (5 diffs)
- trunk/src/player/app.d (modified) (33 diffs)
- trunk/src/player/changelog.txt (modified) (1 diff)
- trunk/src/player/common.d (modified) (2 diffs)
- trunk/src/player/config.d (modified) (9 diffs)
- trunk/src/player/console.d (modified) (11 diffs)
- trunk/src/player/contextmenu.kfg (modified) (2 diffs)
- trunk/src/player/default.kfg (modified) (2 diffs)
- trunk/src/player/expmenu (added)
- trunk/src/player/expmenu.dll (added)
- trunk/src/player/expmenu/EXPMENU.C (added)
- trunk/src/player/expmenu/EXPMENU.sln (added)
- trunk/src/player/expmenu/EXPMENU.vcproj (added)
- trunk/src/player/images/0_forward.ico (modified) (previous)
- trunk/src/player/images/1_player.ico (modified) (previous)
- trunk/src/player/images/3_play.ico (modified) (previous)
- trunk/src/player/images/4_video.ico (modified) (previous)
- trunk/src/player/images/5_video2.ico (modified) (previous)
- trunk/src/player/images/logo (modified) (previous)
- trunk/src/player/lang_English.kfg (modified) (7 diffs)
- trunk/src/player/player.d (modified) (7 diffs)
- trunk/src/player/player.exe (modified) (previous)
- trunk/src/player/playlist.d (modified) (8 diffs)
- trunk/src/player/readme.txt (modified) (2 diffs)
- trunk/src/player/tv (added)
- trunk/src/player/tv/channels.dat (added)
- trunk/src/player/tv/channels.rpl (added)
- trunk/src/player/tv/readme.txt (added)
- trunk/src/player/tv/src (added)
- trunk/src/player/tv/src/build.bat (added)
- trunk/src/player/tv/src/tv2rpl.d (added)
- trunk/src/player/tv/src/xml.d (added)
- trunk/src/player/tv/tv2rpl.exe (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/setup/rulessetup.nsi
r79 r84 1 1 SetCompressor zlib 2 2 3 !define VERSION "0.9 5"3 !define VERSION "0.96" 4 4 Name "rulesPlayer ${VERSION}" 5 5 OutFile "rulessetup.exe" … … 39 39 Var mplayer_version 40 40 Var fatalerrors 41 42 UninstallText "Uninstaller will remove any file in the rulesPlayer directory (really)!" "Uninstalling from:" 41 Var tvtool 42 43 UninstallText "Uninstaller will remove the rulesPlayer directory (really)! Also if you registered some files with rulesPlayer you may wish to unregister them prior to uninstalling." "Uninstalling from:" 43 44 44 45 Function .onInit … … 150 151 Abort 151 152 done: 152 SectionSetText 4$mplayer_section153 SectionSetText 5 $mplayer_section 153 154 FunctionEnd 154 155 … … 170 171 File ".\rulesPlayer\config.kfg" 171 172 SetOverwrite on 173 SectionEnd 174 175 Section "Install TV tool" 176 StrCpy $tvtool "1" 177 File /r ".\rulesPlayer\tv" 172 178 SectionEnd 173 179 … … 244 250 CreateShortCut "$SMPROGRAMS\rulesPlayer\faq.lnk" "$INSTDIR\faq.txt" "" "$INSTDIR\faq.txt" 0 245 251 done: 252 StrCmp $tvtool "1" eq2 done2 253 eq2: 254 CreateShortCut "$SMPROGRAMS\rulesPlayer\tv tool.lnk" "$INSTDIR\tv" "" "$INSTDIR\tv" 0 255 done2: 246 256 SectionEnd 247 257 trunk/src/player/app.d
r79 r84 3 3 //todo: size calculations can be improved when blackband is enabled (test with desktop screen capture) 4 4 5 ////////////////////////(major-minor)/2 6 //todo: mozhe da se napravi screen-a da ne e centriran, a da se centrira rychno s edin drug label nad nego s promenliv razmer 7 // taka shte mozhe da se napravi ako se pokazhe menuto ili kontolite samo s namalqvane na drugiq label da ne myrda screen-a 5 ////////////////////////(major+minor)/2 6 //todo: edit dialog for the playlist items 8 7 9 8 ////////////////////////minor … … 14 13 //todo: bindings for dvd navigation (next/prev title/chapter/angle) 15 14 //todo: no code to handle (s)vcd-s 16 //todo: general code clean up 17 18 19 20 21 22 23 24 25 const char[] appversion ="0.9 5";15 //todo: general code clean up (profile and increase performance) 16 17 18 19 20 21 22 23 24 const char[] appversion ="0.96"; 26 25 const char[] appname ="rulesPlayer"; 27 26 const int last_menu_item_index_in_use =149; 28 //const int last_menu_index_in_use = 4;27 //const int last_menu_index_in_use =5; 29 28 30 29 … … 42 41 import ak.core; 43 42 import win32.win32; 43 import std.c.windows.windows; 44 44 45 45 version (Windows) … … 65 65 pragma(lib,"..\\thirdparty\\dwt\\oleacc_dwt.lib"); 66 66 } 67 68 extern(Windows) alias BOOL function(HWND,LPCTSTR,POINT) DoExplorerMenu_t; 69 DoExplorerMenu_t DoExplorerMenu; 67 70 68 71 class rulesplayer … … 284 287 mitems[15] = new MenuItem (submenu, DWT.CASCADE); 285 288 mitems[15].setText ("Play DVD"); 286 Menu submenu2= new Menu (shell, DWT.DROP_DOWN);287 mitems[15].setMenu ( submenu2);289 menus[5] = new Menu (shell, DWT.DROP_DOWN); 290 mitems[15].setMenu (menus[5]); 288 291 char[4] drv="A:\\\0"; 292 int len=0; 289 293 for(char c='A';c<='Z';c++) 290 294 { … … 292 296 if(GetDriveTypeA(drv.ptr)==DRIVE_CDROM) 293 297 { 294 auto item = new MenuItem ( submenu2, DWT.PUSH); item.handleEvent (new StringObj(drv[0..2].dup),DWT.Selection, delegate (Event e) {298 auto item = new MenuItem (menus[5], DWT.PUSH); item.handleEvent (new StringObj(drv[0..2].dup),DWT.Selection, delegate (Event e) { 295 299 char[][] file; 296 300 file~=(cast(StringObj)e.cData).data; … … 300 304 theapp.player.open(file,1);}); 301 305 item.setText(drv[0..2]); 302 } 303 } 306 len++; 307 } 308 } 309 if(len==0) mitems[15].setEnabled(0); 304 310 //item.setImage(new Image(display,std.path.join(appdir,"images\\dvd"))); 305 311 mitems[9] = new MenuItem (submenu, DWT.PUSH); mitems[9].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.player.quit();}); … … 323 329 mitems[121] = new MenuItem (submenu, DWT.CASCADE); 324 330 mitems[121].setText ("MPlayer priority\t(R)"); 325 submenu2 = new Menu (shell, DWT.DROP_DOWN);331 Menu submenu2 = new Menu (shell, DWT.DROP_DOWN); 326 332 mitems[121].setMenu (submenu2); 327 333 mitems[34] = new MenuItem (submenu2, DWT.RADIO); mitems[34].handleEvent (this,DWT.Selection, delegate (Event e) {if(!(cast(MenuItem)e.widget).getSelection()) return; theapp.config.setVar("mp_priority","idle");}); … … 500 506 mitems[27] = new MenuItem (submenu, DWT.CASCADE); 501 507 mitems[27].setText ("Track\t(R)"); 508 mitems[27].setMenu(menus[1]=new Menu (shell, DWT.DROP_DOWN)); 502 509 //fileItem2.setImage(new Image(display,std.path.join(appdir,"images\\audiotrack"))); 503 510 mitems[134] = new MenuItem (submenu, DWT.CASCADE); … … 547 554 mitems[25] = new MenuItem (submenu, DWT.CASCADE); 548 555 mitems[25].setText ("Track"); 556 mitems[25].setMenu(menus[0]=new Menu (shell, DWT.DROP_DOWN)); 549 557 mitems[138] = new MenuItem (submenu, DWT.CASCADE); 550 558 mitems[138].setText ("Size\t(R)"); … … 682 690 menus[4] = new Menu (shell, DWT.DROP_DOWN); 683 691 mitems[142].setMenu (menus[4]); 684 //fill the language smenu692 //fill the language menu 685 693 bool callback(DirEntry* de) 686 694 { … … 712 720 mitems[143] = new MenuItem (submenu, DWT.CHECK); mitems[143].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.config.setVar("w_centeronresize",std.string.toString(cast(int)!theapp.centeronresize));}); 713 721 mitems[143].setText ("Center after resize"); 722 mitems[116] = new MenuItem (submenu, DWT.CHECK); mitems[116].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.config.setVar("w_startfull",std.string.toString(cast(int)!theapp.startfull));}); 723 mitems[116].setText ("Start in fullscreen"); 724 new MenuItem (submenu, DWT.SEPARATOR); 725 mitems[109] = new MenuItem (submenu, DWT.CHECK); mitems[109].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.config.setVar("w_minimizetotray",std.string.toString(cast(int)!theapp.mintray));}); 726 mitems[109].setText ("Minimize to tray"); 727 mitems[108] = new MenuItem (submenu, DWT.CHECK); mitems[108].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.config.setVar("w_closetotray",std.string.toString(cast(int)!theapp.closetray));}); 728 mitems[108].setText ("Close to tray"); 729 mitems[107] = new MenuItem (submenu, DWT.CHECK); mitems[107].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.config.setVar("w_resideintray",std.string.toString(cast(int)!theapp.residetray));}); 730 mitems[107].setText ("Reside in tray"); 731 new MenuItem (submenu, DWT.SEPARATOR); 714 732 mitems[18] = new MenuItem (submenu, DWT.CHECK); mitems[18].handleEvent (this,DWT.Selection, delegate (Event e) {if(theapp.isfull) return;theapp.config.setVar("w_ontop",std.string.toString(cast(int)!theapp.ontop));}); 715 733 mitems[18].setText ("Stick on top"); 716 mitems[11 6] = new MenuItem (submenu, DWT.CHECK); mitems[116].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.config.setVar("w_startfull",std.string.toString(cast(int)!theapp.startfull));});717 mitems[11 6].setText ("Start in fullscreen");734 mitems[110] = new MenuItem (submenu, DWT.CHECK); mitems[110].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.settitlebar(!theapp.hastitle);}); 735 mitems[110].setText ("Show titlebar"); 718 736 //item.setImage(new Image(display,std.path.join(appdir,"images\\ontop"))); 719 //item = new MenuItem (submenu, DWT.CHECK); item.handleEvent (this,DWT.Selection, delegate (Event e) { });737 //item = new MenuItem (submenu, DWT.CHECK); item.handleEvent (this,DWT.Selection, delegate (Event e) {/*-rootwin but it aint working*/}); 720 738 //item.setText ("Desktop mode"); 739 740 ////////////tray menu 741 trayMenu = new Menu(shell); 742 restoretrayitem = new MenuItem(trayMenu, DWT.PUSH); 743 restoretrayitem.handleEvent(this, DWT.Selection, delegate(Event e){ 744 if(theapp.shell.getMinimized()) theapp.fromTray(); 745 else theapp.toTray(); 746 }); 747 restoretrayitem.setText("Hide"); 748 trayMenu.setDefaultItem(restoretrayitem); 749 new MenuItem(trayMenu, DWT.SEPARATOR); 750 mitems[106] = new MenuItem(trayMenu, DWT.PUSH); 751 mitems[106].setText("Exit"); 752 mitems[106].handleEvent(this, DWT.Selection, delegate(Event e){theapp.closetray=0;theapp.shell.close();}); 721 753 722 754 shell.setLayout(new FillLayout()); … … 728 760 console.show(0); 729 761 playlist.show(0); 762 settitlebar(-1); //save default window styles 730 763 config.exec(std.path.join(appdir,"config.kfg"),0); 731 764 config.exec(std.path.join(appdir,"autoexec.kfg"),0); 732 765 setDefaultStrings(); 733 766 734 shell.setImage(new Image(display,std.path.join(appdir,"images\\icon"))); 767 shellimage=new Image(display,std.path.join(appdir,"images\\icon")); 768 shell.setImage(shellimage); 735 769 736 770 //special initialization … … 1044 1078 } 1045 1079 1046 int ontop ,iscomp;1080 int ontop=0,iscomp=0,hastitle=1; 1047 1081 1048 1082 void setaspect(float asp) … … 1053 1087 } 1054 1088 1055 void compact(int comp) 1089 void settitlebar(int has,int updatevar=1) 1090 { 1091 if(isfull) {updateTitlebar();return;} 1092 if(has==-1) 1093 { 1094 laststyle=GetWindowLongA(shell.handle,GWL_STYLE); 1095 laststyleex=GetWindowLongA(shell.handle,GWL_EXSTYLE); 1096 return; 1097 } 1098 if(!has && hastitle) 1099 { 1100 hastitle=0; 1101 laststyle=GetWindowLongA(shell.handle,GWL_STYLE); 1102 laststyleex=GetWindowLongA(shell.handle,GWL_EXSTYLE); 1103 SetWindowLongA(shell.handle,GWL_STYLE,WS_POPUP|WS_BORDER|WS_THICKFRAME); 1104 SetWindowLongA(shell.handle,GWL_EXSTYLE,0); 1105 shell.setVisible(true); 1106 } 1107 else if(has && !hastitle) 1108 { 1109 hastitle=1; 1110 SetWindowLongA(shell.handle,GWL_STYLE,(laststyle&WS_VISIBLE)?laststyle-WS_VISIBLE:laststyle); 1111 SetWindowLongA(shell.handle,GWL_EXSTYLE,laststyleex); 1112 shell.setVisible(true); 1113 } 1114 if(updatevar) config.setVar("w_titlebar",std.string.toString(hastitle),0); 1115 updateTitlebar(); 1116 } 1117 1118 void compact(int comp,int updatevar=1) 1056 1119 { 1057 1120 if(comp && !iscomp) … … 1091 1154 if(tmove.getState()==Thread.TS.RUNNING) tmove.wait(); 1092 1155 } 1093 config.setVar("w_compact",std.string.toString(iscomp),0);1156 if(updatevar) config.setVar("w_compact",std.string.toString(iscomp),0); 1094 1157 theapp.updateCompact(); 1095 1158 } 1096 1159 1097 void fullscreen(int full )1160 void fullscreen(int full,int updatevar=1) 1098 1161 { 1099 1162 static WINDOWPLACEMENT wp; 1100 static int wascomp ;1163 static int wascomp,alaststyle,alaststyleex; 1101 1164 wp.length=WINDOWPLACEMENT.sizeof; 1102 1165 if(full && !isfull) … … 1104 1167 wascomp=iscomp; 1105 1168 isfull=1; 1169 alaststyle=GetWindowLongA(shell.handle,GWL_STYLE); 1170 alaststyleex=GetWindowLongA(shell.handle,GWL_EXSTYLE); 1171 SetWindowLongA(shell.handle,GWL_STYLE,WS_POPUP|WS_VISIBLE); 1172 SetWindowLongA(shell.handle,GWL_EXSTYLE,WS_EX_APPWINDOW|WS_EX_TOPMOST); 1106 1173 GetWindowPlacement(shell.handle,&wp); 1107 laststyle=GetWindowLongA(shell.handle,GWL_STYLE);1108 laststyleex=GetWindowLongA(shell.handle,GWL_EXSTYLE);1109 1174 Rectangle d=display.getPrimaryMonitor().getBounds(); 1110 1175 lastrect=shell.getBounds(); 1111 SetWindowLongA(shell.handle,GWL_STYLE,WS_POPUP|WS_VISIBLE);1112 SetWindowLongA(shell.handle,GWL_EXSTYLE,WS_EX_APPWINDOW|WS_EX_TOPMOST);1113 1176 settop(1); 1114 1177 shell.setLocation(0,0); … … 1119 1182 { 1120 1183 isfull=0; 1121 SetWindowLongA(shell.handle,GWL_STYLE, laststyle);1122 SetWindowLongA(shell.handle,GWL_EXSTYLE, laststyleex);1184 SetWindowLongA(shell.handle,GWL_STYLE,alaststyle); 1185 SetWindowLongA(shell.handle,GWL_EXSTYLE,alaststyleex); 1123 1186 if(!ontop) settop(0); 1124 1187 //shell.setLocation(lastrect.x,lastrect.y); … … 1131 1194 } 1132 1195 } 1133 config.setVar("w_fullscreen",std.string.toString(isfull),0);1196 if(updatevar) config.setVar("w_fullscreen",std.string.toString(isfull),0); 1134 1197 theapp.updateFullscreen(); 1135 1198 } … … 1138 1201 int mousev=1,mousehidetime; 1139 1202 int isfull,laststyle,laststyleex; 1140 int startfull=0 ;1203 int startfull=0,mintray=0,closetray=0,residetray=0; 1141 1204 dwt.graphics.rectangle.Rectangle lastrect; 1142 1205 … … 1185 1248 void updateFullscreen(){if(noupdate) return;mitems[41].setSelection(theapp.isfull);} 1186 1249 void updateCompact(){if(noupdate) return;mitems[111].setSelection(theapp.iscomp);} 1250 void updateTitlebar(){if(noupdate) return;mitems[110].setSelection(theapp.hastitle);} 1187 1251 void updateDeinterlace(){if(noupdate) return;mitems[22].setSelection(theapp.player.deinterlace);} 1188 1252 void updateIdx(){if(noupdate) return;mitems[69].setSelection(theapp.player.idx);} … … 1328 1392 } 1329 1393 else mitems[56].setEnabled(0); 1394 } 1395 void updateMintray(){if(noupdate) return;mitems[109].setSelection(mintray);} 1396 void updateClosetray(){if(noupdate) return;mitems[108].setSelection(closetray);} 1397 void updateResidetray() 1398 { 1399 if(noupdate) return; 1400 mitems[107].setSelection(residetray); 1401 if(residetray && !trayItem) toTray(0); 1402 else if(!residetray && trayItem) fromTray(0); 1330 1403 } 1331 1404 … … 1375 1448 updateStrings(); 1376 1449 updateLanguage(); 1450 updateResidetray(); 1451 updateClosetray(); 1452 updateMintray(); 1453 updateTitlebar(); 1377 1454 updateStatus(); 1455 updateProgress(); 1378 1456 } 1379 1457 … … 1475 1553 for(int c=0;c<=last_menu_item_index_in_use;c++) 1476 1554 { 1477 if(c==70) c=1 11; //skip encodings1555 if(c==70) c=105; //skip encodings 1478 1556 else if(c==113) c=116; //skip aspect ratios 1479 1557 else if(c==47) c=49; //skip volume … … 1484 1562 else */mitems[c].setText(getString(c+5000)); 1485 1563 } 1564 if(restoretrayitem) restoretrayitem.setText(getString(shell.getMinimized()?111:112)); 1486 1565 btnplay.setToolTipText(getString(55)); 1487 1566 btnpause.setToolTipText(getString(56)); … … 1520 1599 if(r) 1521 1600 { 1522 if(cmd.length) return parseParam( cmd,*r);1601 if(cmd.length) return parseParam(*r,cmd); 1523 1602 else return (*r).dup; 1524 1603 } … … 1553 1632 return 0; 1554 1633 } 1634 } 1635 1636 TrayItem trayItem; 1637 Menu trayMenu; 1638 Image shellimage; 1639 MenuItem restoretrayitem; 1640 1641 void toTray(int hide=1) 1642 { 1643 if(!trayItem) 1644 { 1645 trayItem = new TrayItem(shell.getDisplay().getSystemTray(), DWT.NONE); 1646 trayItem.handleEvent(this, DWT.MenuDetect, delegate(Event e){ 1647 theapp.trayMenu.setLocation(display.getCursorLocation()); 1648 theapp.trayMenu.setVisible(true); 1649 }); 1650 trayItem.handleEvent(this, DWT.Selection, delegate(Event e){ 1651 if(theapp.shell.getMinimized()) theapp.fromTray(); 1652 else theapp.toTray(); 1653 }); 1654 trayItem.setToolTipText(appname); 1655 trayItem.setImage(shellimage); 1656 } 1657 if(hide) 1658 { 1659 if(trayMenu) restoretrayitem.setText(getString(111)); 1660 shell.setMinimized(true); 1661 shell.setVisible(false); 1662 } 1663 } 1664 1665 void fromTray(int show=1) 1666 { 1667 if(trayItem && !residetray) {trayItem.dispose();trayItem=null;} 1668 if(show) 1669 { 1670 if(trayMenu) restoretrayitem.setText(getString(112)); 1671 shell.setVisible(true); 1672 shell.setMinimized(false); 1673 } 1674 } 1675 1676 void exit() 1677 { 1678 noupdate=1; 1679 config.write(std.path.join(appdir,"config.kfg")); 1680 notquit=0; 1681 player.quit(); 1555 1682 } 1556 1683 … … 1610 1737 int l=GetWindowsDirectoryA(dir.ptr,MAX_PATH); 1611 1738 Config.defaults["windows_dir"]=toUTF(dir[0..l].dup); 1739 auto h=LoadLibraryA("expmenu.dll\0".ptr); 1740 if(h) DoExplorerMenu=cast(DoExplorerMenu_t)GetProcAddress(h,"DoExplorerMenu\0".ptr); 1612 1741 display = Display.getDefault(); 1613 1742 theapp=new rulesplayer; 1614 1743 theapp.createshell(); 1615 1744 theapp.player.showlogo(); 1616 theapp.shell.handleEvent(theapp.shell,DWT.Close,delegate(Event e){theapp.noupdate=1; theapp.config.write(std.path.join(appdir,"config.kfg")); notquit=0; theapp.player.quit();}); 1745 theapp.shell.handleEvent(theapp.shell,DWT.Close,delegate(Event e){if(theapp.closetray) {theapp.toTray();e.doit=false;}else theapp.exit();}); 1746 theapp.shell.handleEvent(theapp.shell,DWT.Iconify,delegate(Event e){if(theapp.mintray) {theapp.toTray();e.doit=false;}}); 1617 1747 theapp.shell.handleEvent(theapp.shell,DWT.Deactivate,delegate(Event e){if(theapp.isfull && !indialog) theapp.fullscreen(0);}); 1618 1748 if(argv.length>1) … … 1643 1773 display.sleep(); 1644 1774 } 1775 if(h) FreeLibrary(h); 1645 1776 display.dispose(); 1646 1777 }catch(Object o) … … 2144 2275 translation_strings[104]="Please enter some stuff:"; 2145 2276 translation_strings[105]="Open URL..."; 2277 translation_strings[106]="Subtitle track"; 2278 translation_strings[107]="Audio track"; 2279 translation_strings[108]="error: a file must be opened to display the system menu"; 2280 translation_strings[109]="error: expmenu.dll failed to load properly"; 2281 translation_strings[110]="error: a file must be opened to display information about it"; 2282 translation_strings[111]="Restore"; 2283 translation_strings[112]="Hide"; 2284 translation_strings[113]="Enter title for the playlist item:"; 2285 translation_strings[114]="Search the playlist..."; 2146 2286 2147 2287 translation_strings[5028]="&File"; … … 2229 2369 translation_strings[5014]="Resize after movie"; 2230 2370 translation_strings[5143]="Center after resize"; 2371 translation_strings[5116]="Start in fullscreen mode"; 2372 translation_strings[5109]="Minimize to tray"; 2373 translation_strings[5108]="Close to tray"; 2374 translation_strings[5107]="Reside in tray"; 2231 2375 translation_strings[5018]="Stick on top"; 2232 translation_strings[511 6]="Start in fullscreen mode";2376 translation_strings[5110]="Show titlebar"; 2233 2377 translation_strings[5144]="Add file(s)..."; 2234 2378 translation_strings[5145]="Add URL..."; … … 2237 2381 translation_strings[5148]="Save..."; 2238 2382 translation_strings[5149]="Load..."; 2383 translation_strings[5106]="Exit"; 2384 translation_strings[5105]="Search..."; 2239 2385 2240 2386 translation_helps["alias"]="command: alias <name> <command>\nusage: creates an alias named 'name' for 'command'"; … … 2301 2447 translation_helps["updateui"]="command: updateui\nusage: updates the user interface so any translations could take effect"; 2302 2448 translation_helps["getinput"]="command: getinput <varname> [prompt]\nusage: asks the user for input and saves it to variable named 'varname'"; 2449 translation_helps["menu_subtrack"]="command: menu_subtrack <itemname>\nusage: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the subtitle tracks menu"; 2450 translation_helps["menu_audiotrack"]="command: menu_audiotrack <itemname>\nusage: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the audio tracks menu"; 2451 translation_helps["menu_language"]="command: menu_language <itemname>\nusage: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the language menu"; 2452 translation_helps["menu_playdvd"]="command: menu_playdvd <itemname>\nusage: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the play dvd menu"; 2453 translation_helps["menu_dvd"]="command: menu_dvd <itemname>\nusage: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the dvd menu"; 2454 translation_helps["menu_recent"]="command: menu_recent <itemname>\nusage: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the recent files menu"; 2455 translation_helps["menu_system"]="command: menu_system\nusage: displays the OS shell menu for the currently playing file"; 2456 translation_helps["pladd2"]="command: pladd [title] [file]\nusage: adds a file to the playlist with specified title"; 2457 translation_helps["pladdurl2"]="command: pladdurl [title] [file]\nusage: adds a file to the playlist with specified title"; 2458 translation_helps["plsearch"]="command: plsearch [string]\nerror: displays a playlist search dialog box"; 2303 2459 }} trunk/src/player/changelog.txt
r79 r84 1 0.96 2 3 Fixed @ prefix now works per command instead of per line (which means "@cmd1 && @cmd2" is now valid instead of "@cmd1 && cmd2" to prevent both commands from echo) 4 Fixed missing string for "stick on top" in lang_English.kfg 5 Fixed bug in deleting playlist items 6 Fixed and improved playlist saving 7 Fixed bug in loading playlist where MPlayer was first item was started several times 8 Added feature to remove the titlebar 9 Added new commands to allow the context menus to be populated with some more dynamic menus: menu_audiotrack, menu_dvd, menu_language, menu_playdvd, menu_recent, menu_subtrack, menu_system 10 Added some new junk to the default context menu 11 Added new context menu - ctrl+mouse3 to display system menu about the file 12 Added features to minimize/close/reside in tray 13 Added pladd2 and pladdurl2 commands 14 Added plsearch command 15 Added a small utility to extract web tv channels 16 Changed the logo (thanks to Tod) 17 18 1 19 0.95 2 20 trunk/src/player/common.d
r79 r84 17 17 if(!str) return null; 18 18 else if(str.eof()) return null; 19 const int extra=100 ;19 const int extra=1000; 20 20 int len=0; 21 21 char ch=0; … … 187 187 } 188 188 189 char[] parseParam(in char[] [] cmd,in char[] param)189 char[] parseParam(in char[] param,in char[][] cmd) 190 190 { 191 191 char[] ret; trunk/src/player/config.d
r79 r84 56 56 { 57 57 File f=new File(path,FileMode.In); 58 auto fs=new AsciiStream(f); 58 59 char[] line; 59 60 for(;;) 60 61 { 61 line=f .readLine();62 line=fs.readLine(); 62 63 if(line) 63 64 { 65 line=toUTF(line); 64 66 if(line.length && line[$-1]=='\\' && (line.length>=2 && line[$-2]!='\\')) 65 67 { … … 67 69 while(1) 68 70 { 69 char[] tl=f .readLine();71 char[] tl=fs.readLine(); 70 72 if(tl) 71 73 { 74 tl=toUTF(tl); 72 75 line.length=line.length-1; 73 76 line~=tl; … … 95 98 { 96 99 auto var=name in variables; 97 if(var) return parseParam( cmd,*var);100 if(var) return parseParam(*var,cmd); 98 101 else return null; 99 102 } … … 139 142 else if(namehash==hash!("w_mhidetime")) {theapp.mousehidetime=atoi(value);} 140 143 else if(namehash==hash!("god")) {theapp.god=cast(int)(atoi(value)!=0);} 141 else if(namehash==hash!("w_fullscreen")) {theapp.fullscreen(cast(int)(atoi(value)!=0));} 142 else if(namehash==hash!("w_compact")) {theapp.compact(cast(int)(atoi(value)!=0));} 144 else if(namehash==hash!("w_fullscreen")) {theapp.fullscreen(cast(int)(atoi(value)!=0),0);} 145 else if(namehash==hash!("w_compact")) {theapp.compact(cast(int)(atoi(value)!=0),0);} 146 else if(namehash==hash!("w_titlebar")){theapp.settitlebar(cast(int)(atoi(value)!=0),0);} 143 147 else if(namehash==hash!("w_startfull")) {theapp.startfull=(cast(int)(atoi(value)!=0));updatedg=&theapp.updateStartfull;} 144 148 else if(namehash==hash!("v_aspectratio")) {theapp.setaspect(cast(float)(atof(value)));} … … 164 168 else if(namehash==hash!("mp_priority")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updatePriority;} 165 169 else if(namehash==hash!("v_pp")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updatePP;} 166 //else if(namehash==hash!("mp_vo")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updateVO;}170 else if(namehash==hash!("mp_vo")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updateVO;} 167 171 else if(namehash==hash!("mp_ao")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updateAO;} 168 172 else if(namehash==hash!("sub_codepage")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updateCodepage;} 169 173 else if(namehash==hash!("recentfiles")){int i=atoi(value); if(i<0) {i=0;} theapp.recentfiles=i; theapp.allrecentfiles.length=i; updatedg=&theapp.updateRecent;} 174 else if(namehash==hash!("w_minimizetotray")) {theapp.mintray=cast(int)(atoi(value)!=0); updatedg=&theapp.updateMintray;} 175 else if(namehash==hash!("w_closetotray")) {theapp.closetray=cast(int)(atoi(value)!=0); updatedg=&theapp.updateClosetray;} 176 else if(namehash==hash!("w_resideintray")) {theapp.residetray=cast(int)(atoi(value)!=0); updatedg=&theapp.updateResidetray;} 170 177 } 171 178 variables[name]=value; … … 179 186 { 180 187 auto var=name in defaults; 181 if(var) return parseParam( null,*var);188 if(var) return parseParam(*var,null); 182 189 else return null; 183 190 } … … 191 198 if(allowrestart && theapp.player.running) theapp.player.restart(); 192 199 else theapp.updateUI(); 193 //theapp.updateUI();194 //theapp.updateStatus();195 //theapp.updateProgress();196 200 } 197 201 … … 247 251 defaults["a_deflang"]="en"; 248 252 defaults["a_track"]="0"; 253 defaults["w_resideintray"]="0"; 254 defaults["w_closetotray"]="0"; 255 defaults["w_minimizetotray"]="0"; 249 256 defaults["w_ontop"]="0"; 250 257 defaults["w_fullscreen"]="0"; 251 258 defaults["w_compact"]="0"; 252 259 defaults["w_language"]="English"; 260 defaults["w_resizetomovie"]="1"; 261 defaults["w_mhidetime"]="1000"; 262 defaults["w_startfull"]="0"; 263 defaults["w_centeronresize"]="0"; 264 defaults["w_titlebar"]="1"; 253 265 defaults["sub_deflang"]="en,eng"; 254 266 defaults["sub_shown"]="1"; … … 263 275 defaults["dvd_title"]="0"; 264 276 defaults["dvd_angle"]="0"; 265 defaults["w_resizetomovie"]="1";266 defaults["w_mhidetime"]="1000";267 defaults["w_startfull"]="0";268 defaults["w_centeronresize"]="0";269 277 defaults["fileicon"]="1"; 270 278 defaults["sensitivity"]="10"; trunk/src/player/console.d
r79 r84 1 private import dwt.all; 2 private import app; 3 private import config; 4 private import player; 5 private import std.string; 6 private import std.ctype; 7 private import std.path; 8 private import std.file; 9 private import common; 10 private import ak.core; 1 import dwt.all; 2 import app; 3 import config; 4 import player; 5 import std.string; 6 import std.ctype; 7 import std.path; 8 import std.file; 9 import common; 10 import playlist; 11 import ak.core; 12 import std.c.windows.windows; 11 13 12 14 class Console : Composite … … 26 28 Menu[] menus; 27 29 MenuItem[] menuitems; 30 int[] sharedmenuitems; 28 31 Menu lastmenu; 29 32 char[][] autocomplete; 30 33 char[] autocompleteprefix; 31 static char[][] cmdlist=["about","alias","aliaslist","bind","bindlist","dec","decf","echo","exec","eval","errors","exit","clear","clearhistory","close","freemem","getinput","help","inc","incf","info","menu begin","menuend","menuitem","menuseparator","mpcmd","open","openaudio","openurl","pladd","pladddvd","pladdurl","playorpause","plclear","plload","plnext","plprev","plsave","plsort","recentadd","recentdel","recentclear","registerext","reset","resetall","say","set","sethelp","setimage","setstring","speed_inc","speed_dec","stop","toggle","unalias","unaliasall","unbind","unbindall","updateui","unregisterext","unset","unsetall","varlist","write","yell","zoom"];34 static char[][] cmdlist=["about","alias","aliaslist","bind","bindlist","dec","decf","echo","exec","eval","errors","exit","clear","clearhistory","close","freemem","getinput","help","inc","incf","info","menu_audiotrack","menu_dvd","menu_language","menu_playdvd","menu_recent","menu_subtrack","menu_system","menubegin","menuend","menuitem","menuseparator","mpcmd","open","openaudio","openurl","pladd","pladd2","pladddvd","pladdurl","pladdurl2","playorpause","plclear","plload","plnext","plprev","plsave","plsearch","plsort","recentadd","recentdel","recentclear","registerext","reset","resetall","say","set","sethelp","setimage","setstring","speed_inc","speed_dec","stop","toggle","unalias","unaliasall","unbind","unbindall","updateui","unregisterext","unset","unsetall","varlist","write","yell","zoom"]; 32 35 33 36 void append(char[] line,int internal=1) … … 45 48 if(!line.length) return; 46 49 if(line.length>=2 && line[0..2]=="//") return; 47 int ls=0;48 if(line[0]=='@') {showline=0;ls++;}49 if(line.length-ls<=0) return;50 50 if(trackhistory) 51 51 { … … 53 53 currentline=pastlines.length; 54 54 } 55 char[][] acmd=parseCommandLine(line [ls..line.length]);55 char[][] acmd=parseCommandLine(line); 56 56 char[][][] ar; 57 57 int last=0; … … 62 62 } 63 63 if(last<acmd.length) ar~=acmd[last..acmd.length]; 64 int ogshowline=showline; 64 65 foreach(char[][] cmd;ar) 65 66 { 66 67 char[][] params=cmd.dup; 67 foreach(int i,char[] p;params) params[i]=parseParam(params,p); 68 foreach(int i,char[] p;params) params[i]=parseParam(p,params); 69 if(params[0][0]=='@') {showline=0;if(params[0].length==1) continue;else params[0]=params[0][1..$];} 70 else showline=ogshowline; 68 71 auto al=params[0] in aliases; 69 72 if(!al && showline && theapp.config.echo) append(">"~std.string.join(cmd," ")); … … 259 262 else if(p0hash==hash!("about")) 260 263 { 261 static char[] text=appname~" "~appversion~"\nbobef license: use without restrictions at your own risk\nhome: http://rulesplayer.lessequal.com\n\ncontributors (alphabetical):\n\tBen Laufer\n\t Stefan Teodorescu\n\tTod\n\t...and everybody who's name is missing here\t\n\nsoftware used:\n\tMPlayer - www.mplayer.hq\n\tMPUI - mpui.sourceforge.net\n\tRegan Heath - pipestream library\n\tDWT - www.dsource.org/projects/dwt\n\tD - www.digitalmars.com/d\n\tCrystal icons - www.everaldo.com\n\tXN resource editor - www.wilsonc.demon.co.uk\n\ticon sushi - www.towofu.net/soft\n\takide - www.lessequal.com/software/akide\n\tEclipse Visual Editor - www.eclipse.org/vep";264 static char[] text=appname~" "~appversion~"\nbobef license: use without restrictions at your own risk\nhome: http://rulesplayer.lessequal.com\n\ncontributors (alphabetical):\n\tBen Laufer\n\tcracksloth\n\tStefan Teodorescu\n\tTod\n\t...and everybody who's name is missing here\t\n\nsoftware used:\n\tMPlayer - www.mplayer.hq\n\tMPUI - mpui.sourceforge.net\n\tpipestream library - Regan Heath\n\tDWT - www.dsource.org/projects/dwt\n\tD - www.digitalmars.com/d\n\tCrystal icons - www.everaldo.com\n\tXN resource editor - www.wilsonc.demon.co.uk\n\ticon sushi - www.towofu.net/soft\n\takide - www.lessequal.com/software/akide\n\tEclipse Visual Editor - www.eclipse.org/vep"; 262 265 msgBox(text,"About rulesPlayer",DWT.ICON_INFORMATION); 263 266 } 264 267 else if(p0hash==hash!("info")) 265 268 { 266 if(!(theapp.player.proc && theapp.player.proc.isRunning())) return;269 if(!(theapp.player.proc && theapp.player.proc.isRunning())) {append(theapp.getString(110));return;} 267 270 char[][] text; 268 271 text~=theapp.getString(91)~": "~theapp.player.info.filename; … … 294 297 else theapp.playlist.add(params[1..params.length]); 295 298 } 299 else if(p0hash==hash!("pladd2")) 300 { 301 char[][] titles; 302 char[][] files; 303 if(params.length<2) 304 { 305 auto i=new inputrequest; 306 indialog=1; 307 char[] title=i.create(theapp.getString(113),0); 308 indialog=0; 309 if(title.length) titles~=title; 310 } 311 else titles~=params[1]; 312 if(params.length<3) 313 { 314 indialog=1; 315 files=dxFileDialog.open(theapp.getString(99),DWT.OPEN,theapp.filtera,theapp.filterb); 316 indialog=0; 317 } 318 else files~=params[2]; 319 if(!files.length || !titles.length) {append(theapp.getString(13,paramMake(params[0])));return;} 320 else theapp.playlist.add(files,titles); 321 } 296 322 else if(p0hash==hash!("pladddvd")) 297 323 { … … 308 334 files~=i.create(theapp.getString(22)); 309 335 indialog=0; 310 if(files.length && files[0].length) theapp.playlist.add(files, -1,i.dmp);336 if(files.length && files[0].length) theapp.playlist.add(files,null,-1,i.dmp); 311 337 } 312 338 else theapp.playlist.add(params[1..params.length]); 339 } 340 else if(p0hash==hash!("pladdurl2")) 341 { 342 char[][] titles; 343 char[][] files; 344 int dmp=0; 345 if(params.length<2) 346 { 347 auto i=new inputrequest; 348 indialog=1; 349 char[] title=i.create(theapp.getString(113),0); 350 indialog=0; 351 if(title.length) titles~=title; 352 } 353 else titles~=params[1]; 354 if(params.length<3) 355 { 356 auto i=new inputrequest; 357 indialog=1; 358 char[] file=i.create(theapp.getString(22)); 359 indialog=0; 360 if(file.length) files~=file; 361 dmp=i.dmp; 362 } 363 else files~=params[2]; 364 if(!files.length || !titles.length) {append(theapp.getString(13,paramMake(params[0])));return;} 365 else theapp.playlist.add(files,titles,-1,dmp); 366 } 367 else if(p0hash==hash!("plsearch")) 368 { 369 auto i=new plsearch; 370 indialog=1; 371 int r=i.create(params.length>1?params[1]:null); 372 indialog=0; 373 if(r>=0) theapp.playlist.play(r); 313 374 } 314 375 else if(p0hash==hash!("errors")) errors(params.length<2 || atoi(params[1])); … … 367 428 if(theapp.iscomp) 368 429 { 369 menus[0].handleEvent (this,DWT. Dispose, delegate (Event e) {theapp.showcursor(0);});430 menus[0].handleEvent (this,DWT.Hide, delegate (Event e) {theapp.showcursor(0);}); 370 431 theapp.showcursor(1); 371 432 } 433 menus[0].handleEvent (this,DWT.Hide, delegate (Event e) {foreach(i;theapp.console.sharedmenuitems) theapp.console.menuitems[i].setMenu(null); theapp.console.sharedmenuitems=null;}); 372 434 menus[0].setLocation(display.getCursorLocation()); 373 435 menus[0].setVisible(true); 374 436 menustarted=0; 375 437 } 438 } 439 else if(p0hash==hash!("menu_dvd") || p0hash==hash!("menu_recent") || p0hash==hash!("menu_playdvd") || p0hash==hash!("menu_audiotrack") || p0hash==hash!("menu_subtrack") || p0hash==hash!("menu_language")) 440 { 441 if(!menustarted || !lastmenu) {append(theapp.getString(16));return;} 442 else if(params.length<2) {append(theapp.getString(13,paramMake(params[0])));return;} 443 int i=menuitems.length; 444 int i2=0; 445 if(p0hash==hash!("menu_dvd")) i2=2; 446 else if(p0hash==hash!("menu_recent")) i2=3; 447 else if(p0hash==hash!("menu_playdvd")) i2=5; 448 else if(p0hash==hash!("menu_audiotrack")) i2=1; 449 else if(p0hash==hash!("menu_subtrack")) i2=0; 450 else /*if(p0hash==hash!("menu_language"))*/ i2=4; 451 menuitems~=new MenuItem (lastmenu, DWT.CASCADE); 452 menuitems[i].setText (params[1]); 453 if(i2 in theapp.menus) 454 { 455 menuitems[i].setMenu(theapp.menus[i2]); 456 if(theapp.menus[i2].getItems().length==0) menuitems[i].setEnabled(0); 457 } 458 sharedmenuitems~=i; 459 } 460 else if(p0hash==hash!("menu_system")) 461 { 462 if(!theapp.player.info.filename.length) {append(theapp.getString(108));return;} 463 if(DoExplorerMenu) 464 { 465 auto p=display.map(null,theapp.shell,display.getCursorLocation()); 466 POINT p2; 467 p2.x=p.x; 468 p2.y=p.y; 469 DoExplorerMenu(theapp.shell.handle,toStringz(theapp.player.info.filename),p2); 470 } 471 else append(theapp.getString(109)); 376 472 } 377 473 else if(p0hash==hash!("speed_inc")) theapp.player.speed_inc(); … … 390 486 else if(p0hash==hash!("clear")) history.setText(null); 391 487 else if(p0hash==hash!("clearhistory")) {pastlines=null;currentline=0;} 392 else if(p0hash==hash!("exit")) theapp.shell.close();488 else if(p0hash==hash!("exit")) {theapp.closetray=0;theapp.shell.close();} 393 489 else if(p0hash==hash!("zoom")) 394 490 { … … 470 566 { 471 567 auto alcmd=parseCommandLine(*al); 472 params[0]=parseParam( params,alcmd[0]);473 foreach(int i,char[] p;alcmd) alcmd[i]=parseParam(p arams,p).dup;568 params[0]=parseParam(alcmd[0],params); 569 foreach(int i,char[] p;alcmd) alcmd[i]=parseParam(p,params).dup; 474 570 char[][] str; 475 571 str~=alcmd[0]; trunk/src/player/contextmenu.kfg
r79 r84 2 2 menuitem $#30 @open 3 3 menuitem $#105 @openurl 4 menu_playdvd $#5015 5 menu_recent $#5118 4 6 menuitem $#31 @close 5 7 menuseparator … … 22 24 menuend 23 25 menuseparator 26 menu_dvd $#8 27 menu_subtrack $#106 28 menu_audiotrack $#107 29 menuseparator 24 30 menuitem $#5119 @info 25 31 menuitem $#5120 @about trunk/src/player/default.kfg
r79 r84 30 30 bind v "@toggle sub_shown" 31 31 bind d "@mpcmd frame_drop" 32 bind j "@plsearch" 32 33 bind mouse1 @playorpause 33 34 bind mouse1dbl @fullscreen … … 35 36 bind wheelup "@incf a_volume 5" 36 37 bind wheeldown "@decf a_volume 5" 38 bind ctrl+mouse3 @menu_system 37 39 alias play @playorpause 38 40 alias pause @playorpause 39 41 alias fullscreen "@toggle w_fullscreen" 40 42 alias compact "@toggle w_compact" 43 alias titlebar "@toggle w_titlebar" 41 44 alias step "@mpcmd frame_step" 42 45 alias subvisiblity "@toggle sub_shown" trunk/src/player/lang_English.kfg
r79 r84 40 40 setstring 0028 "$#12: $$0 is neither 0 or 1" 41 41 setstring 0101 "$#12: unable to execute config file $$0" 42 setstring 0108 "$#12: a file must be opened to display the system menu" 43 setstring 0110 "$#12: a file must be opened to display information about it" 44 setstring 0109 "$#12: expmenu.dll failed to load properly" 42 45 setstring 0019 "listing available commands:" 43 46 setstring 0020 "listing aliases:" … … 56 59 setstring 0032 "Playback" 57 60 setstring 0105 "Open URL..." 61 setstring 0106 "Subtitle track" 62 setstring 0107 "Audio track" 58 63 // 59 64 //error box title … … 83 88 //the playlist 84 89 // 90 setstring 0114 "Search the playlist..." 85 91 setstring 0036 "Playlist" 86 92 setstring 0102 "Colours" … … 117 123 //the input dialog 118 124 // 125 setstring 0113 "Enter title for the playlist item:" 119 126 setstring 0104 "Please enter some stuff:" 120 127 setstring 0022 "Enter URL:" … … 162 169 setstring 0097 "There was some error extacting the info (see console)" 163 170 setstring 0098 "Clip information" 171 // 172 //tray menu 173 // 174 setstring 0111 "Restore" 175 setstring 0112 "Hide" 164 176 // 165 177 //////////////// menus … … 255 267 setstring 5014 "Resize after movie" 256 268 setstring 5143 "Center after resize" 269 setstring 5116 "Start in fullscreen mode" 270 setstring 5109 "Minimize to tray" 271 setstring 5108 "Close to tray" 272 setstring 5107 "Reside in tray" 257 273 setstring 5018 "Stick on top" 258 setstring 511 6 "Start in fullscreen mode"274 setstring 5110 "Show titlebar" 259 275 //playlist [+] button popup 260 276 setstring 5144 "Add file(s)..." 261 277 setstring 5145 "Add URL..." 278 setstring 5105 "Search..." 262 279 setstring 5146 "Sort" 263 280 setstring 5147 "Clear" 264 281 setstring 5148 "Save..." 265 282 setstring 5149 "Load..." 283 //tray menu 284 setstring 5106 "Exit" 266 285 // 267 286 // help … … 330 349 sethelp updateui "$#1: updateui\n$#2: updates the user interface so any translations could take effect" 331 350 sethelp getinput "$#1: getinput <varname> [prompt]\n$#2: asks the user for input and saves it to variable named 'varname'" 351 sethelp menu_subtrack "$#1: menu_subtrack <itemname>\n$#2: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the subtitle tracks menu" 352 sethelp menu_audiotrack "$#1: menu_audiotrack <itemname>\n$#2: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the audio tracks menu" 353 sethelp menu_language "$#1: menu_language <itemname>\n$#2: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the language menu" 354 sethelp menu_playdvd "$#1: menu_playdvd <itemname>\n$#2: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the play dvd menu" 355 sethelp menu_dvd "$#1: menu_dvd <itemname>\n$#2: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the dvd menu" 356 sethelp menu_recent "$#1: menu_recent <itemname>\n$#2: adds a menu item called 'itemname' in a menu created with menubegin, filling it with the contents of the recent files menu" 357 sethelp menu_system "$#1: menu_system\n$#2: displays the OS shell menu for the currently playing file" 358 sethelp pladd2 "$#1: pladd [title] [file]\n$#2: adds a file to the playlist with specified title" 359 sethelp pladdurl2 "$#1: pladdurl [title] [file]\n$#2: adds a file to the playlist with specified title" 360 sethelp plsearch "$#1: plsearch [string]\n$#2: displays a playlist search dialog box" trunk/src/player/player.d
r79 r84 187 187 restarting=0; 188 188 theapp.updateUI(); 189 theapp.updateStatus();190 theapp.updateProgress();191 189 } 192 190 … … 219 217 for(;c<ret.length;c++) if(ret[c]!=' ') break; 220 218 theapp.setStatus(theapp.getString(86,paramMake(ret[c..find(ret,"%")+1]))); 219 return echomp==2; 221 220 } 222 221 else if(startcmp(liner,"*** screenshot '",ret)) … … 670 669 theapp.updateProgress(); 671 670 } 672 else if(icmp(str," quit")==0)671 else if(icmp(str," ")==0) 673 672 { 674 673 theapp.setStatus(theapp.getString(78)); … … 677 676 reset(); 678 677 theapp.updateUI(); 679 theapp.updateStatus();680 theapp.updateProgress();681 678 } 682 679 } … … 911 908 if(playlists==files.length) 912 909 { 913 if(theapp.playlist.autoplay && status!=PLAY && status!=PAUSE) theapp.playlist.playcurrent();910 //if(theapp.playlist.autoplay && status!=PLAY && status!=PAUSE) theapp.playlist.playcurrent(); 914 911 return; 915 912 } … … 1085 1082 char[] dvdtitle; 1086 1083 1087 void quit(int logo=1,int timeout= 300)1084 void quit(int logo=1,int timeout=2000) 1088 1085 { 1089 1086 wantupdate=0; … … 1120 1117 if(status!=ERROR && status!=DUMPED) status=NONE; 1121 1118 theapp.updateUI(); 1122 theapp.updateStatus();1123 theapp.updateProgress();1124 1119 reset(); 1125 1120 theapp.updateStrack(); trunk/src/player/playlist.d
r78 r84 74 74 } 75 75 76 void add(char[][] f,int i=-1,int dump=0) 77 { 76 void add(char[][] f,char[][] titles=null,int i=-1,int dump=0) 77 { 78 int ll=files.length; 79 if(f.length) files.length=files.length+f.length; 78 80 foreach(int ii,char[] a;f) 79 81 { … … 84 86 else 85 87 { 86 if(getDrive(a).length>2) t=a.dup; 88 if(ii<titles.length) t=titles[ii]; 89 else if(getDrive(a).length>2) t=a; 87 90 else t=getBaseName(a); 88 91 } 89 92 item=new TableItem(playlist, DWT.NONE); 90 item.setText(paramMake(cast(int)( files.length)+1,t));93 item.setText(paramMake(cast(int)(ll)+1,t)); 91 94 ff.isdvd=0; 92 95 ff.fullpath=a.dup; 93 96 ff.name=t.dup; 94 ff.index= files.length;97 ff.index=ll; 95 98 ff.dump=dump; 96 files ~=ff;99 files[ll++]=ff; 97 100 } 98 101 if(autoplay && files.length && current==-1) {play(0);} 99 onsize(1); 100 } 102 if(!loadingplaylist) onsize(1); 103 } 104 105 int loadingplaylist=0; 101 106 102 107 void hl(int i) … … 222 227 else file=f[0]; 223 228 } 229 loadingplaylist=1; 224 230 theapp.config.exec(file); 225 if(autoplay && theapp.player.status!=theapp.player.PLAY && theapp.player.status!=theapp.player.PAUSE) playcurrent(); 231 loadingplaylist=0; 232 onsize(1); 233 //if(autoplay && theapp.player.status!=theapp.player.PLAY && theapp.player.status!=theapp.player.PAUSE) playcurrent(); 226 234 } 227 235 … … 240 248 foreach(a;files) 241 249 { 242 if(!a.isdvd) str=("pladd \""~replace(replace(a.fullpath,"\"","\\\""),"$","$$")~"\"\n");243 else str=("pladddvd \""~replace(replace( a.fullpath,"\"","\\\""),"$","$$")~'"'~" "~.toString(a.title)~" "~.toString(a.chapter)~" "~.toString(a.angle)~"\n");250 if(!a.isdvd) str=("pladd2 \""~replace(replace(replace(replace(replace(a.name,"\\","\\\\"),"\t","\\t"),"\n","\\n"),"\"","\\\""),"$","$$")~"\" \""~replace(replace(replace(replace(replace(a.fullpath,"\\","\\\\"),"\t","\\t"),"\n","\\n"),"\"","\\\""),"$","$$")~"\"\n"); 251 else str=("pladddvd \""~replace(replace(replace(replace(replace(a.fullpath,"\\","\\\\"),"\t","\\t"),"\n","\\n"),"\"","\\\""),"$","$$")~'"'~" "~.toString(a.title)~" "~.toString(a.chapter)~" "~.toString(a.angle)~"\n"); 244 252 f.writeExact(str.ptr,str.length); 245 253 } … … 311 319 filess~=*c; 312 320 } 313 if(filess.length) add(filess, current+1);321 if(filess.length) add(filess,null,current+1); 314 322 } 315 323 … … 497 505 if(!a.length) return; 498 506 table.remove(a); 499 for(int c= 0;c<a.length;c++) TArray!(plfile).deleteItems(theapp.playlist.files,a[c],1);507 for(int c=a.length-1;c>=0;c--) TArray!(plfile).deleteItems(theapp.playlist.files,a[c],1); 500 508 for(int c=0;c<theapp.playlist.files.length;c++) table.getItem(c).setText(0,.toString(c+1)); 501 509 if(a.length==1) … … 651 659 theapp.mitems[145].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.console.execLine("pladdurl",0,0);}); 652 660 new MenuItem (menu, DWT.SEPARATOR); 661 theapp.mitems[105] = new MenuItem (menu, DWT.PUSH); theapp.mitems[105].setText ("Search..."); 662 theapp.mitems[105].handleEvent (this,DWT.Selection, delegate (Event e){theapp.console.execLine("plsearch",0,0);}); 653 663 theapp.mitems[146] = new MenuItem (menu, DWT.PUSH); theapp.mitems[146].setText ("Sort"); 654 664 theapp.mitems[146].handleEvent (this,DWT.Selection, delegate (Event e){theapp.playlist.sort();}); … … 781 791 } 782 792 } 793 794 class plsearch 795 { 796 Shell sShell; 797 Label label; 798 Text input; 799 Button ok; 800 Button cancel; 801 List list; 802 int index=-1; 803 int[int] indices; 804 805 int create(char[] initial=null) 806 { 807 GridData gridData4 = new GridData(); 808 gridData4.horizontalAlignment = GridData.END; 809 gridData4.grabExcessHorizontalSpace = true; 810 gridData4.widthHint = 50; 811 gridData4.verticalAlignment = GridData.CENTER; 812 GridData gridData3 = new GridData(); 813 gridData3.horizontalAlignment = GridData.END; 814 gridData3.widthHint = 50; 815 gridData3.verticalAlignment = GridData.CENTER; 816 GridData gridData1 = new GridData(); 817 gridData1.horizontalSpan = 2; 818 gridData1.verticalAlignment = GridData.CENTER; 819 gridData1.grabExcessHorizontalSpace = true; 820 gridData1.horizontalAlignment = GridData.FILL; 821 GridData gridData11 = new GridData(); 822 gridData11.horizontalSpan = 2; 823 gridData11.verticalAlignment = GridData.CENTER; 824 gridData11.grabExcessHorizontalSpace = true; 825 gridData11.horizontalAlignment = GridData.FILL; 826 gridData11.heightHint = 200; 827 GridLayout gridLayout = new GridLayout(); 828 gridLayout.makeColumnsEqualWidth = false; 829 gridLayout.marginWidth = 10; 830 gridLayout.marginHeight = 10; 831 gridLayout.verticalSpacing = 5; 832 gridLayout.numColumns = 2; 833 gridLayout.horizontalSpacing = 5; 834 sShell = new Shell(theapp.shell,DWT.DIALOG_TRIM|DWT.APPLICATION_MODAL); 835 sShell.setText(theapp.getString(114)); 836 sShell.setLayout(gridLayout); 837 sShell.setSize(new Point(385, 300)); 838 input = new Text(sShell, DWT.BORDER); 839 if(!initial.length && theapp.playlist.current>=0) initial=theapp.playlist.files[theapp.playlist.current].name; 840 input.setText(initial); 841 input.setSelection(0,initial.length); 842 input.setLayoutData(gridData1); 843 input.handleEvent (this,DWT.Modify, delegate(Event e){(cast(plsearch)e.cData).update();}); 844 /*input.handleEvent (this,DWT.KeyDown, delegate (Event e) { 845 auto s=(cast(plsearch)e.cData); 846 auto i=s.list.getSelectionIndex(); 847 if(i==0 || i+1>=s.list.getItemCount()) return; 848 if(e.keyCode==DWT.ARROW_UP) s.list.setSelection(i-1,i-1); 849 else if(e.keyCode==DWT.ARROW_DOWN) s.list.setSelection(i+1,i+1); 850 })*/; 851 list = new List(sShell, DWT.BORDER|DWT.V_SCROLL|DWT.SINGLE); 852 /*list.handleEvent (this,DWT.MouseDoubleClick, delegate (Event e){ 853 auto s=(cast(plsearch)e.cData); 854 auto i=s.list.getItem(new Point(e.x,e.y)); 855 s.list.setSelection(i,i); 856 });*/ 857 list.setLayoutData(gridData11); 858 cancel = new Button(sShell, DWT.NONE); 859 cancel.setText(theapp.getString(72)); 860 cancel.setLayoutData(gridData4); 861 cancel.handleEvent (this,DWT.Selection, &oncancel); 862 ok = new Button(sShell, DWT.NONE); 863 ok.setText(theapp.getString(73)); 864 ok.setLayoutData(gridData3); 865 ok.handleEvent (this,DWT.Selection, &onok); 866 Rectangle bounds = display.getPrimaryMonitor().getBounds (); 867 Rectangle rect = sShell.getBounds (); 868 int x = bounds.x + (bounds.width - rect.width) / 2; 869 int y = bounds.y + (bounds.height - rect.height) / 2; 870 sShell.setLocation (x, y); 871 sShell.setDefaultButton(cancel); 872 sShell.open(); 873 if(initial.length) update(); 874 while(!sShell.isDisposed()) if(!display.readAndDispatch()) display.sleep(); 875 return index; 876 } 877 878 void update() 879 { 880 list.removeAll(); 881 indices=null; 882 int ok=0; 883 char[][] a=parseCommandLine(input.getText()); 884 int last=0; 885 for(int c=0;c<theapp.playlist.files.length;c++) 886 { 887 foreach(char[] word;a) 888 { 889 if(ifind(theapp.playlist.files[c].name,word)>=0) 890 { 891 ok=1; 892 indices[last++]=theapp.playlist.files[c].index; 893 list.add(theapp.playlist.files[c].name); 894 break; 895 } 896 } 897 } 898 if(ok) list.setSelection(0,0); 899 } 900 901 void onok(Event e) 902 { 903 sShell.close(); 904 } 905 906 void oncancel(Event e) 907 { 908 index=list.getSelectionIndex(); 909 if(index>=0) index=indices[index]; 910 sShell.close(); 911 } 912 } trunk/src/player/readme.txt
r83 r84 88 88 d - change frame drop mode 89 89 p - toggle playlist 90 j - search the playlist 90 91 ` (tilde) - show console (escape to hide it) 91 92 escape - hide playlist or console (depending on which one has the focus) … … 95 96 mouse1 double - fullscreen 96 97 mouse3 - context menu 98 ctrl+mouse3 - OS shell menu 97 99 wheelup - audio volume +5% 98 100 wheeldown - audio volume -5%
