Changeset 84

Show
Ignore:
Timestamp:
01/31/07 08:38:33 (5 years ago)
Author:
bobef
Message:

updated to rulesPlayer 0.96

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/setup/rulessetup.nsi

    r79 r84  
    11SetCompressor zlib 
    22 
    3 !define VERSION "0.95
     3!define VERSION "0.96
    44Name "rulesPlayer ${VERSION}" 
    55OutFile "rulessetup.exe" 
     
    3939Var mplayer_version 
    4040Var fatalerrors 
    41  
    42 UninstallText "Uninstaller will remove any file in the rulesPlayer directory (really)!" "Uninstalling from:" 
     41Var tvtool 
     42 
     43UninstallText "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:" 
    4344 
    4445Function .onInit 
     
    150151  Abort 
    151152done: 
    152   SectionSetText 4 $mplayer_section 
     153  SectionSetText 5 $mplayer_section 
    153154FunctionEnd 
    154155 
     
    170171  File ".\rulesPlayer\config.kfg" 
    171172  SetOverwrite on 
     173SectionEnd 
     174 
     175Section "Install TV tool" 
     176  StrCpy $tvtool "1" 
     177  File /r ".\rulesPlayer\tv" 
    172178SectionEnd 
    173179 
     
    244250  CreateShortCut "$SMPROGRAMS\rulesPlayer\faq.lnk" "$INSTDIR\faq.txt" "" "$INSTDIR\faq.txt" 0 
    245251  done: 
     252  StrCmp $tvtool "1" eq2 done2 
     253  eq2: 
     254  CreateShortCut "$SMPROGRAMS\rulesPlayer\tv tool.lnk" "$INSTDIR\tv" "" "$INSTDIR\tv" 0 
     255  done2: 
    246256SectionEnd 
    247257 
  • trunk/src/player/app.d

    r79 r84  
    33//todo: size calculations can be improved when blackband is enabled (test with desktop screen capture) 
    44 
    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 
    87 
    98////////////////////////minor 
     
    1413//todo: bindings for dvd navigation (next/prev title/chapter/angle) 
    1514//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.95"; 
     15//todo: general code clean up (profile and increase performance) 
     16 
     17 
     18 
     19 
     20 
     21 
     22 
     23 
     24const char[] appversion                     ="0.96"; 
    2625const char[] appname                        ="rulesPlayer"; 
    2726const 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
    2928 
    3029 
     
    4241import ak.core; 
    4342import win32.win32; 
     43import std.c.windows.windows; 
    4444 
    4545version (Windows) 
     
    6565    pragma(lib,"..\\thirdparty\\dwt\\oleacc_dwt.lib"); 
    6666} 
     67 
     68extern(Windows) alias BOOL function(HWND,LPCTSTR,POINT) DoExplorerMenu_t; 
     69DoExplorerMenu_t DoExplorerMenu; 
    6770 
    6871class rulesplayer 
     
    284287        mitems[15] = new MenuItem (submenu, DWT.CASCADE); 
    285288        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]); 
    288291        char[4] drv="A:\\\0"; 
     292        int len=0; 
    289293        for(char c='A';c<='Z';c++) 
    290294        { 
     
    292296            if(GetDriveTypeA(drv.ptr)==DRIVE_CDROM) 
    293297            { 
    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) { 
    295299                    char[][] file; 
    296300                    file~=(cast(StringObj)e.cData).data; 
     
    300304                    theapp.player.open(file,1);}); 
    301305                item.setText(drv[0..2]); 
    302             } 
    303         } 
     306                len++; 
     307            } 
     308        } 
     309        if(len==0) mitems[15].setEnabled(0); 
    304310        //item.setImage(new Image(display,std.path.join(appdir,"images\\dvd"))); 
    305311        mitems[9] = new MenuItem (submenu, DWT.PUSH); mitems[9].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.player.quit();}); 
     
    323329        mitems[121] = new MenuItem (submenu, DWT.CASCADE); 
    324330        mitems[121].setText ("MPlayer priority\t(R)"); 
    325         submenu2 = new Menu (shell, DWT.DROP_DOWN); 
     331        Menu submenu2 = new Menu (shell, DWT.DROP_DOWN); 
    326332        mitems[121].setMenu (submenu2); 
    327333        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");}); 
     
    500506        mitems[27] = new MenuItem (submenu, DWT.CASCADE); 
    501507        mitems[27].setText ("Track\t(R)"); 
     508        mitems[27].setMenu(menus[1]=new Menu (shell, DWT.DROP_DOWN)); 
    502509        //fileItem2.setImage(new Image(display,std.path.join(appdir,"images\\audiotrack"))); 
    503510        mitems[134] = new MenuItem (submenu, DWT.CASCADE); 
     
    547554        mitems[25] = new MenuItem (submenu, DWT.CASCADE); 
    548555        mitems[25].setText ("Track"); 
     556        mitems[25].setMenu(menus[0]=new Menu (shell, DWT.DROP_DOWN)); 
    549557        mitems[138] = new MenuItem (submenu, DWT.CASCADE); 
    550558        mitems[138].setText ("Size\t(R)"); 
     
    682690        menus[4] = new Menu (shell, DWT.DROP_DOWN); 
    683691        mitems[142].setMenu (menus[4]); 
    684         //fill the languages menu 
     692        //fill the language menu 
    685693        bool callback(DirEntry* de) 
    686694        { 
     
    712720        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));}); 
    713721        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); 
    714732        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));}); 
    715733        mitems[18].setText ("Stick on top"); 
    716         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));}); 
    717         mitems[116].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"); 
    718736        //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*/}); 
    720738        //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();}); 
    721753 
    722754        shell.setLayout(new FillLayout()); 
     
    728760        console.show(0); 
    729761        playlist.show(0); 
     762        settitlebar(-1); //save default window styles 
    730763        config.exec(std.path.join(appdir,"config.kfg"),0); 
    731764        config.exec(std.path.join(appdir,"autoexec.kfg"),0); 
    732765        setDefaultStrings(); 
    733766 
    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); 
    735769 
    736770        //special initialization 
     
    10441078    } 
    10451079 
    1046     int ontop,iscomp
     1080    int ontop=0,iscomp=0,hastitle=1
    10471081 
    10481082    void setaspect(float asp) 
     
    10531087    } 
    10541088 
    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) 
    10561119    { 
    10571120        if(comp && !iscomp) 
     
    10911154            if(tmove.getState()==Thread.TS.RUNNING) tmove.wait(); 
    10921155        } 
    1093         config.setVar("w_compact",std.string.toString(iscomp),0); 
     1156        if(updatevar) config.setVar("w_compact",std.string.toString(iscomp),0); 
    10941157        theapp.updateCompact(); 
    10951158    } 
    10961159 
    1097     void fullscreen(int full
     1160    void fullscreen(int full,int updatevar=1
    10981161    { 
    10991162        static WINDOWPLACEMENT wp; 
    1100         static int wascomp
     1163        static int wascomp,alaststyle,alaststyleex
    11011164        wp.length=WINDOWPLACEMENT.sizeof; 
    11021165        if(full && !isfull) 
     
    11041167            wascomp=iscomp; 
    11051168            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); 
    11061173            GetWindowPlacement(shell.handle,&wp); 
    1107             laststyle=GetWindowLongA(shell.handle,GWL_STYLE); 
    1108             laststyleex=GetWindowLongA(shell.handle,GWL_EXSTYLE); 
    11091174            Rectangle d=display.getPrimaryMonitor().getBounds(); 
    11101175            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); 
    11131176            settop(1); 
    11141177            shell.setLocation(0,0); 
     
    11191182        { 
    11201183            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); 
    11231186            if(!ontop) settop(0); 
    11241187            //shell.setLocation(lastrect.x,lastrect.y); 
     
    11311194            } 
    11321195        } 
    1133         config.setVar("w_fullscreen",std.string.toString(isfull),0); 
     1196        if(updatevar) config.setVar("w_fullscreen",std.string.toString(isfull),0); 
    11341197        theapp.updateFullscreen(); 
    11351198    } 
     
    11381201    int mousev=1,mousehidetime; 
    11391202    int isfull,laststyle,laststyleex; 
    1140     int startfull=0
     1203    int startfull=0,mintray=0,closetray=0,residetray=0
    11411204    dwt.graphics.rectangle.Rectangle lastrect; 
    11421205 
     
    11851248    void updateFullscreen(){if(noupdate) return;mitems[41].setSelection(theapp.isfull);} 
    11861249    void updateCompact(){if(noupdate) return;mitems[111].setSelection(theapp.iscomp);} 
     1250    void updateTitlebar(){if(noupdate) return;mitems[110].setSelection(theapp.hastitle);} 
    11871251    void updateDeinterlace(){if(noupdate) return;mitems[22].setSelection(theapp.player.deinterlace);} 
    11881252    void updateIdx(){if(noupdate) return;mitems[69].setSelection(theapp.player.idx);} 
     
    13281392        } 
    13291393        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); 
    13301403    } 
    13311404 
     
    13751448        updateStrings(); 
    13761449        updateLanguage(); 
     1450        updateResidetray(); 
     1451        updateClosetray(); 
     1452        updateMintray(); 
     1453        updateTitlebar(); 
    13771454        updateStatus(); 
     1455        updateProgress(); 
    13781456    } 
    13791457 
     
    14751553        for(int c=0;c<=last_menu_item_index_in_use;c++) 
    14761554        { 
    1477             if(c==70) c=111;  //skip encodings 
     1555            if(c==70) c=105;  //skip encodings 
    14781556            else if(c==113) c=116; //skip aspect ratios 
    14791557            else if(c==47) c=49; //skip volume 
     
    14841562            else */mitems[c].setText(getString(c+5000)); 
    14851563        } 
     1564        if(restoretrayitem) restoretrayitem.setText(getString(shell.getMinimized()?111:112)); 
    14861565        btnplay.setToolTipText(getString(55)); 
    14871566        btnpause.setToolTipText(getString(56)); 
     
    15201599        if(r) 
    15211600        { 
    1522             if(cmd.length) return parseParam(cmd,*r); 
     1601            if(cmd.length) return parseParam(*r,cmd); 
    15231602            else return (*r).dup; 
    15241603        } 
     
    15531632            return 0; 
    15541633        } 
     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(); 
    15551682    } 
    15561683 
     
    16101737    int l=GetWindowsDirectoryA(dir.ptr,MAX_PATH); 
    16111738    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); 
    16121741    display = Display.getDefault(); 
    16131742    theapp=new rulesplayer; 
    16141743    theapp.createshell(); 
    16151744    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;}}); 
    16171747    theapp.shell.handleEvent(theapp.shell,DWT.Deactivate,delegate(Event e){if(theapp.isfull && !indialog) theapp.fullscreen(0);}); 
    16181748    if(argv.length>1) 
     
    16431773        display.sleep(); 
    16441774    } 
     1775    if(h) FreeLibrary(h); 
    16451776    display.dispose(); 
    16461777    }catch(Object o) 
     
    21442275    translation_strings[104]="Please enter some stuff:"; 
    21452276    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..."; 
    21462286 
    21472287    translation_strings[5028]="&File"; 
     
    22292369    translation_strings[5014]="Resize after movie"; 
    22302370    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"; 
    22312375    translation_strings[5018]="Stick on top"; 
    2232     translation_strings[5116]="Start in fullscreen mode"; 
     2376    translation_strings[5110]="Show titlebar"; 
    22332377    translation_strings[5144]="Add file(s)..."; 
    22342378    translation_strings[5145]="Add URL..."; 
     
    22372381    translation_strings[5148]="Save..."; 
    22382382    translation_strings[5149]="Load..."; 
     2383    translation_strings[5106]="Exit"; 
     2384    translation_strings[5105]="Search..."; 
    22392385 
    22402386    translation_helps["alias"]="command: alias <name> <command>\nusage: creates an alias named 'name' for 'command'"; 
     
    23012447    translation_helps["updateui"]="command: updateui\nusage: updates the user interface so any translations could take effect"; 
    23022448    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"; 
    23032459}} 
  • trunk/src/player/changelog.txt

    r79 r84  
     10.96 
     2 
     3Fixed @ 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) 
     4Fixed missing string for "stick on top" in lang_English.kfg 
     5Fixed bug in deleting playlist items 
     6Fixed and improved playlist saving 
     7Fixed bug in loading playlist where MPlayer was first item was started several times 
     8Added feature to remove the titlebar 
     9Added 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 
     10Added some new junk to the default context menu 
     11Added new context menu - ctrl+mouse3 to display system menu about the file 
     12Added features to minimize/close/reside in tray 
     13Added pladd2 and pladdurl2 commands 
     14Added plsearch command 
     15Added a small utility to extract web tv channels 
     16Changed the logo (thanks to Tod) 
     17 
     18 
    1190.95 
    220 
  • trunk/src/player/common.d

    r79 r84  
    1717        if(!str) return null; 
    1818        else if(str.eof()) return null; 
    19         const int extra=100
     19        const int extra=1000
    2020        int len=0; 
    2121        char ch=0; 
     
    187187} 
    188188 
    189 char[] parseParam(in char[][] cmd,in char[] param
     189char[] parseParam(in char[] param,in char[][] cmd
    190190{ 
    191191    char[] ret; 
  • trunk/src/player/config.d

    r79 r84  
    5656        { 
    5757            File f=new File(path,FileMode.In); 
     58            auto fs=new AsciiStream(f); 
    5859            char[] line; 
    5960            for(;;) 
    6061            { 
    61                 line=f.readLine(); 
     62                line=fs.readLine(); 
    6263                if(line) 
    6364                { 
     65                    line=toUTF(line); 
    6466                    if(line.length && line[$-1]=='\\' && (line.length>=2 && line[$-2]!='\\')) 
    6567                    { 
     
    6769                        while(1) 
    6870                        { 
    69                             char[] tl=f.readLine(); 
     71                            char[] tl=fs.readLine(); 
    7072                            if(tl) 
    7173                            { 
     74                                tl=toUTF(tl); 
    7275                                line.length=line.length-1; 
    7376                                line~=tl; 
     
    9598    { 
    9699        auto var=name in variables; 
    97         if(var) return parseParam(cmd,*var); 
     100        if(var) return parseParam(*var,cmd); 
    98101        else return null; 
    99102    } 
     
    139142            else if(namehash==hash!("w_mhidetime")) {theapp.mousehidetime=atoi(value);} 
    140143            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);} 
    143147            else if(namehash==hash!("w_startfull")) {theapp.startfull=(cast(int)(atoi(value)!=0));updatedg=&theapp.updateStartfull;} 
    144148            else if(namehash==hash!("v_aspectratio")) {theapp.setaspect(cast(float)(atof(value)));} 
     
    164168            else if(namehash==hash!("mp_priority")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updatePriority;} 
    165169            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;} 
    167171            else if(namehash==hash!("mp_ao")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updateAO;} 
    168172            else if(namehash==hash!("sub_codepage")){if(theapp.player.running()) needrestart=1; else updatedg=&theapp.updateCodepage;} 
    169173            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;} 
    170177        } 
    171178        variables[name]=value; 
     
    179186    { 
    180187        auto var=name in defaults; 
    181         if(var) return parseParam(null,*var); 
     188        if(var) return parseParam(*var,null); 
    182189        else return null; 
    183190    } 
     
    191198        if(allowrestart && theapp.player.running) theapp.player.restart(); 
    192199        else theapp.updateUI(); 
    193         //theapp.updateUI(); 
    194         //theapp.updateStatus(); 
    195         //theapp.updateProgress(); 
    196200    } 
    197201 
     
    247251        defaults["a_deflang"]="en"; 
    248252        defaults["a_track"]="0"; 
     253        defaults["w_resideintray"]="0"; 
     254        defaults["w_closetotray"]="0"; 
     255        defaults["w_minimizetotray"]="0"; 
    249256        defaults["w_ontop"]="0"; 
    250257        defaults["w_fullscreen"]="0"; 
    251258        defaults["w_compact"]="0"; 
    252259        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"; 
    253265        defaults["sub_deflang"]="en,eng"; 
    254266        defaults["sub_shown"]="1"; 
     
    263275        defaults["dvd_title"]="0"; 
    264276        defaults["dvd_angle"]="0"; 
    265         defaults["w_resizetomovie"]="1"; 
    266         defaults["w_mhidetime"]="1000"; 
    267         defaults["w_startfull"]="0"; 
    268         defaults["w_centeronresize"]="0"; 
    269277        defaults["fileicon"]="1"; 
    270278        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; 
     1import dwt.all; 
     2import app; 
     3import config; 
     4import player; 
     5import std.string; 
     6import std.ctype; 
     7import std.path; 
     8import std.file; 
     9import common; 
     10import playlist; 
     11import ak.core; 
     12import std.c.windows.windows; 
    1113 
    1214class Console : Composite 
     
    2628    Menu[] menus; 
    2729    MenuItem[] menuitems; 
     30    int[] sharedmenuitems; 
    2831    Menu lastmenu; 
    2932    char[][] autocomplete; 
    3033    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","menubegin","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"]; 
    3235 
    3336    void append(char[] line,int internal=1) 
     
    4548        if(!line.length) return; 
    4649        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; 
    5050        if(trackhistory) 
    5151        { 
     
    5353            currentline=pastlines.length; 
    5454        } 
    55         char[][] acmd=parseCommandLine(line[ls..line.length]); 
     55        char[][] acmd=parseCommandLine(line); 
    5656        char[][][] ar; 
    5757        int last=0; 
     
    6262        } 
    6363        if(last<acmd.length) ar~=acmd[last..acmd.length]; 
     64        int ogshowline=showline; 
    6465        foreach(char[][] cmd;ar) 
    6566        { 
    6667            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; 
    6871            auto al=params[0] in aliases; 
    6972            if(!al && showline && theapp.config.echo) append(">"~std.string.join(cmd," ")); 
     
    259262            else if(p0hash==hash!("about")) 
    260263            { 
    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\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\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"; 
    262265                msgBox(text,"About rulesPlayer",DWT.ICON_INFORMATION); 
    263266            } 
    264267            else if(p0hash==hash!("info")) 
    265268            { 
    266                 if(!(theapp.player.proc && theapp.player.proc.isRunning())) return; 
     269                if(!(theapp.player.proc && theapp.player.proc.isRunning())) {append(theapp.getString(110));return;} 
    267270                char[][] text; 
    268271                text~=theapp.getString(91)~": "~theapp.player.info.filename; 
     
    294297                else theapp.playlist.add(params[1..params.length]); 
    295298            } 
     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            } 
    296322            else if(p0hash==hash!("pladddvd")) 
    297323            { 
     
    308334                    files~=i.create(theapp.getString(22)); 
    309335                    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); 
    311337                } 
    312338                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); 
    313374            } 
    314375            else if(p0hash==hash!("errors")) errors(params.length<2 || atoi(params[1])); 
     
    367428                    if(theapp.iscomp) 
    368429                    { 
    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);}); 
    370431                        theapp.showcursor(1); 
    371432                    } 
     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;}); 
    372434                    menus[0].setLocation(display.getCursorLocation()); 
    373435                    menus[0].setVisible(true); 
    374436                    menustarted=0; 
    375437                } 
     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)); 
    376472            } 
    377473            else if(p0hash==hash!("speed_inc")) theapp.player.speed_inc(); 
     
    390486            else if(p0hash==hash!("clear")) history.setText(null); 
    391487            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();} 
    393489            else if(p0hash==hash!("zoom")) 
    394490            { 
     
    470566            { 
    471567                auto alcmd=parseCommandLine(*al); 
    472                 params[0]=parseParam(params,alcmd[0]); 
    473                 foreach(int i,char[] p;alcmd) alcmd[i]=parseParam(params,p).dup; 
     568                params[0]=parseParam(alcmd[0],params); 
     569                foreach(int i,char[] p;alcmd) alcmd[i]=parseParam(p,params).dup; 
    474570                char[][] str; 
    475571                str~=alcmd[0]; 
  • trunk/src/player/contextmenu.kfg

    r79 r84  
    22    menuitem $#30 @open 
    33    menuitem $#105 @openurl 
     4    menu_playdvd $#5015 
     5    menu_recent $#5118 
    46    menuitem $#31 @close 
    57    menuseparator 
     
    2224    menuend 
    2325    menuseparator 
     26    menu_dvd $#8 
     27    menu_subtrack $#106 
     28    menu_audiotrack $#107 
     29    menuseparator 
    2430    menuitem $#5119 @info 
    2531    menuitem $#5120 @about 
  • trunk/src/player/default.kfg

    r79 r84  
    3030bind v "@toggle sub_shown" 
    3131bind d "@mpcmd frame_drop" 
     32bind j "@plsearch" 
    3233bind mouse1 @playorpause 
    3334bind mouse1dbl @fullscreen 
     
    3536bind wheelup "@incf a_volume 5" 
    3637bind wheeldown "@decf a_volume 5" 
     38bind ctrl+mouse3 @menu_system 
    3739alias play @playorpause 
    3840alias pause @playorpause 
    3941alias fullscreen "@toggle w_fullscreen" 
    4042alias compact "@toggle w_compact" 
     43alias titlebar "@toggle w_titlebar" 
    4144alias step "@mpcmd frame_step" 
    4245alias subvisiblity "@toggle sub_shown" 
  • trunk/src/player/lang_English.kfg

    r79 r84  
    4040setstring 0028 "$#12: $$0 is neither 0 or 1" 
    4141setstring 0101 "$#12: unable to execute config file $$0" 
     42setstring 0108 "$#12: a file must be opened to display the system menu" 
     43setstring 0110 "$#12: a file must be opened to display information about it" 
     44setstring 0109 "$#12: expmenu.dll failed to load properly" 
    4245setstring 0019 "listing available commands:" 
    4346setstring 0020 "listing aliases:" 
     
    5659setstring 0032 "Playback" 
    5760setstring 0105 "Open URL..." 
     61setstring 0106 "Subtitle track" 
     62setstring 0107 "Audio track" 
    5863// 
    5964//error box title 
     
    8388//the playlist 
    8489// 
     90setstring 0114 "Search the playlist..." 
    8591setstring 0036 "Playlist" 
    8692setstring 0102 "Colours" 
     
    117123//the input dialog 
    118124// 
     125setstring 0113 "Enter title for the playlist item:" 
    119126setstring 0104 "Please enter some stuff:" 
    120127setstring 0022 "Enter URL:" 
     
    162169setstring 0097 "There was some error extacting the info (see console)" 
    163170setstring 0098 "Clip information" 
     171// 
     172//tray menu 
     173// 
     174setstring 0111 "Restore" 
     175setstring 0112 "Hide" 
    164176// 
    165177//////////////// menus 
     
    255267setstring 5014 "Resize after movie" 
    256268setstring 5143 "Center after resize" 
     269setstring 5116 "Start in fullscreen mode" 
     270setstring 5109 "Minimize to tray" 
     271setstring 5108 "Close to tray" 
     272setstring 5107 "Reside in tray" 
    257273setstring 5018 "Stick on top" 
    258 setstring 5116 "Start in fullscreen mode
     274setstring 5110 "Show titlebar
    259275//playlist [+] button  popup 
    260276setstring 5144 "Add file(s)..." 
    261277setstring 5145 "Add URL..." 
     278setstring 5105 "Search..." 
    262279setstring 5146 "Sort" 
    263280setstring 5147 "Clear" 
    264281setstring 5148 "Save..." 
    265282setstring 5149 "Load..." 
     283//tray menu 
     284setstring 5106 "Exit" 
    266285// 
    267286// help 
     
    330349sethelp updateui "$#1: updateui\n$#2: updates the user interface so any translations could take effect" 
    331350sethelp getinput "$#1: getinput <varname> [prompt]\n$#2: asks the user for input and saves it to variable named 'varname'" 
     351sethelp 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" 
     352sethelp 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" 
     353sethelp 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" 
     354sethelp 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" 
     355sethelp 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" 
     356sethelp 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" 
     357sethelp menu_system "$#1: menu_system\n$#2: displays the OS shell menu for the currently playing file" 
     358sethelp pladd2 "$#1: pladd [title] [file]\n$#2: adds a file to the playlist with specified title" 
     359sethelp pladdurl2 "$#1: pladdurl [title] [file]\n$#2: adds a file to the playlist with specified title" 
     360sethelp plsearch "$#1: plsearch [string]\n$#2: displays a playlist search dialog box" 
  • trunk/src/player/player.d

    r79 r84  
    187187            restarting=0; 
    188188            theapp.updateUI(); 
    189             theapp.updateStatus(); 
    190             theapp.updateProgress(); 
    191189        } 
    192190 
     
    219217            for(;c<ret.length;c++) if(ret[c]!=' ') break; 
    220218            theapp.setStatus(theapp.getString(86,paramMake(ret[c..find(ret,"%")+1]))); 
     219            return echomp==2; 
    221220        } 
    222221        else if(startcmp(liner,"*** screenshot '",ret)) 
     
    670669                theapp.updateProgress(); 
    671670            } 
    672             else if(icmp(str,"quit")==0) 
     671            else if(icmp(str," ")==0) 
    673672            { 
    674673                theapp.setStatus(theapp.getString(78)); 
     
    677676                    reset(); 
    678677                    theapp.updateUI(); 
    679                     theapp.updateStatus(); 
    680                     theapp.updateProgress(); 
    681678                } 
    682679            } 
     
    911908        if(playlists==files.length) 
    912909        { 
    913             if(theapp.playlist.autoplay && status!=PLAY && status!=PAUSE) theapp.playlist.playcurrent(); 
     910            //if(theapp.playlist.autoplay && status!=PLAY && status!=PAUSE) theapp.playlist.playcurrent(); 
    914911            return; 
    915912        } 
     
    10851082    char[] dvdtitle; 
    10861083 
    1087     void quit(int logo=1,int timeout=300) 
     1084    void quit(int logo=1,int timeout=2000) 
    10881085    { 
    10891086        wantupdate=0; 
     
    11201117        if(status!=ERROR && status!=DUMPED) status=NONE; 
    11211118        theapp.updateUI(); 
    1122         theapp.updateStatus(); 
    1123         theapp.updateProgress(); 
    11241119        reset(); 
    11251120        theapp.updateStrack(); 
  • trunk/src/player/playlist.d

    r78 r84  
    7474    } 
    7575 
    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; 
    7880        foreach(int ii,char[] a;f) 
    7981        { 
     
    8486            else 
    8587            { 
    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; 
    8790                else t=getBaseName(a); 
    8891            } 
    8992            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)); 
    9194            ff.isdvd=0; 
    9295            ff.fullpath=a.dup; 
    9396            ff.name=t.dup; 
    94             ff.index=files.length
     97            ff.index=ll
    9598            ff.dump=dump; 
    96             files~=ff; 
     99            files[ll++]=ff; 
    97100        } 
    98101        if(autoplay && files.length && current==-1) {play(0);} 
    99         onsize(1); 
    100     } 
     102        if(!loadingplaylist) onsize(1); 
     103    } 
     104 
     105    int loadingplaylist=0; 
    101106 
    102107    void hl(int i) 
     
    222227            else file=f[0]; 
    223228        } 
     229        loadingplaylist=1; 
    224230        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(); 
    226234    } 
    227235 
     
    240248        foreach(a;files) 
    241249        { 
    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"); 
    244252            f.writeExact(str.ptr,str.length); 
    245253        } 
     
    311319            filess~=*c; 
    312320        } 
    313         if(filess.length) add(filess,current+1); 
     321        if(filess.length) add(filess,null,current+1); 
    314322    } 
    315323 
     
    497505                    if(!a.length) return; 
    498506                    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); 
    500508                    for(int c=0;c<theapp.playlist.files.length;c++) table.getItem(c).setText(0,.toString(c+1)); 
    501509                    if(a.length==1) 
     
    651659        theapp.mitems[145].handleEvent (this,DWT.Selection, delegate (Event e) {theapp.console.execLine("pladdurl",0,0);}); 
    652660        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);}); 
    653663        theapp.mitems[146] = new MenuItem (menu, DWT.PUSH); theapp.mitems[146].setText ("Sort"); 
    654664        theapp.mitems[146].handleEvent (this,DWT.Selection, delegate (Event e){theapp.playlist.sort();}); 
     
    781791    } 
    782792} 
     793 
     794class 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  
    8888d - change frame drop mode 
    8989p - toggle playlist 
     90j - search the playlist 
    9091` (tilde) - show console (escape to hide it) 
    9192escape - hide playlist or console (depending on which one has the focus) 
     
    9596mouse1 double - fullscreen 
    9697mouse3 - context menu 
     98ctrl+mouse3 - OS shell menu 
    9799wheelup - audio volume +5% 
    98100wheeldown - audio volume -5%