r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / awindowmenu.C
blob69755c2221d33cce622e487d0a9852344b53b985
1 #include "awindow.h"
2 #include "awindowgui.h"
3 #include "awindowmenu.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "mwindow.h"
8 #include <libintl.h>
9 #define _(String) gettext(String)
10 #define gettext_noop(String) String
11 #define N_(String) gettext_noop (String)
16 AssetListMenu::AssetListMenu(MWindow *mwindow, AWindowGUI *gui)
17  : BC_PopupMenu(0, 
18                 0, 
19                 0, 
20                 "", 
21                 0)
23         this->mwindow = mwindow;
24         this->gui = gui;
27 AssetListMenu::~AssetListMenu()
31 void AssetListMenu::create_objects()
33         add_item(format = new AssetListFormat(mwindow));
34         add_item(new AssetListSort(mwindow));
35         update_titles();
38 void AssetListMenu::update_titles()
40         format->update();
50 AssetListFormat::AssetListFormat(MWindow *mwindow)
51  : BC_MenuItem("")
53         this->mwindow = mwindow;
56 void AssetListFormat::update()
58         set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
59                 (char*)_("Display icons") : (char*)_("Display text"));
62 int AssetListFormat::handle_event()
64         switch(mwindow->edl->session->assetlist_format)
65         {
66                 case ASSETS_TEXT:
67                         mwindow->edl->session->assetlist_format = ASSETS_ICONS;
68                         break;
69                 case ASSETS_ICONS:
70                         mwindow->edl->session->assetlist_format = ASSETS_TEXT;
71                         break;
72         }
74         mwindow->awindow->gui->asset_list->update_format(
75                 mwindow->edl->session->assetlist_format, 
76                 1);
78         return 1;
84 AssetListSort::AssetListSort(MWindow *mwindow)
85  : BC_MenuItem(_("Sort items"))
87         this->mwindow = mwindow;
90 int AssetListSort::handle_event()
92         mwindow->awindow->gui->sort_assets();
93         return 1;
99 FolderListMenu::FolderListMenu(MWindow *mwindow, AWindowGUI *gui)
100  : BC_PopupMenu(0, 
101                 0, 
102                 0, 
103                 "", 
104                 0)
106         this->mwindow = mwindow;
107         this->gui = gui;
110 FolderListMenu::~FolderListMenu()
113         
114 void FolderListMenu::create_objects()
116         add_item(format = new FolderListFormat(mwindow, this));
117         update_titles();
122 void FolderListMenu::update_titles()
124         format->set_text(mwindow->edl->session->folderlist_format == FOLDERS_TEXT ?
125                 (char*)_("Display icons") : (char*)_("Display text"));
134 FolderListFormat::FolderListFormat(MWindow *mwindow, FolderListMenu *menu)
135  : BC_MenuItem("")
137         this->mwindow = mwindow;
138         this->menu = menu;
140 int FolderListFormat::handle_event()
142         switch(mwindow->edl->session->folderlist_format)
143         {
144                 case ASSETS_TEXT:
145                         mwindow->edl->session->folderlist_format = ASSETS_ICONS;
146                         break;
147                 case ASSETS_ICONS:
148                         mwindow->edl->session->folderlist_format = ASSETS_TEXT;
149                         break;
150         }
152         mwindow->awindow->gui->folder_list->update_format(mwindow->edl->session->folderlist_format, 1);
153         menu->update_titles();
155         return 1;