rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowmenu.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "awindow.h"
23 #include "awindowgui.h"
24 #include "awindowmenu.h"
25 #include "edl.h"
26 #include "edlsession.h"
27 #include "language.h"
28 #include "mwindow.h"
29
30
31
32
33
34 AssetListMenu::AssetListMenu(MWindow *mwindow, AWindowGUI *gui)
35  : BC_PopupMenu(0,
36                 0,
37                 0,
38                 "",
39                 0)
40 {
41         this->mwindow = mwindow;
42         this->gui = gui;
43 }
44
45 AssetListMenu::~AssetListMenu()
46 {
47 }
48
49 void AssetListMenu::create_objects()
50 {
51         add_item(format = new AssetListFormat(mwindow));
52         add_item(new AssetListSort(mwindow));
53         update_titles();
54 }
55
56 void AssetListMenu::update_titles()
57 {
58         format->update();
59 }
60
61
62
63
64
65
66
67
68 AssetListFormat::AssetListFormat(MWindow *mwindow)
69  : BC_MenuItem("")
70 {
71         this->mwindow = mwindow;
72 }
73
74 void AssetListFormat::update()
75 {
76         set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
77                 (char*)_("Display icons") : (char*)_("Display text"));
78 }
79
80 int AssetListFormat::handle_event()
81 {
82         AWindowGUI *agui = mwindow->awindow->gui;
83         agui->stop_vicon_drawing();
84
85         EDLSession *session = mwindow->edl->session;
86         switch(session->assetlist_format) {
87         case ASSETS_TEXT:
88                 session->assetlist_format = ASSETS_ICONS;
89                 break;
90         case ASSETS_ICONS:
91                 session->assetlist_format = ASSETS_TEXT;
92                 break;
93         }
94
95         agui->asset_list->update_format(session->assetlist_format, 1);
96         if (!mwindow->awindow->gui->allow_iconlisting) {
97                 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
98         }
99
100         agui->start_vicon_drawing();
101         return 1;
102 }
103
104
105
106
107 AssetListSort::AssetListSort(MWindow *mwindow)
108  : BC_MenuItem(_("Sort items"))
109 {
110         this->mwindow = mwindow;
111 }
112
113 int AssetListSort::handle_event()
114 {
115         mwindow->awindow->gui->sort_assets();
116         return 1;
117 }
118
119
120
121
122 FolderListMenu::FolderListMenu(MWindow *mwindow, AWindowGUI *gui)
123  : BC_PopupMenu(0,
124                 0,
125                 0,
126                 "",
127                 0)
128 {
129         this->mwindow = mwindow;
130         this->gui = gui;
131 }
132
133 FolderListMenu::~FolderListMenu()
134 {
135 }
136
137 void FolderListMenu::create_objects()
138 {
139         add_item(format = new FolderListFormat(mwindow, this));
140         update_titles();
141 }
142
143
144
145 void FolderListMenu::update_titles()
146 {
147         format->set_text(mwindow->edl->session->folderlist_format == FOLDERS_TEXT ?
148                 (char*)_("Display icons") : (char*)_("Display text"));
149 }
150
151
152
153
154
155
156
157 FolderListFormat::FolderListFormat(MWindow *mwindow, FolderListMenu *menu)
158  : BC_MenuItem("")
159 {
160         this->mwindow = mwindow;
161         this->menu = menu;
162 }
163 int FolderListFormat::handle_event()
164 {
165         switch(mwindow->edl->session->folderlist_format)
166         {
167                 case FOLDERS_TEXT:
168                         mwindow->edl->session->folderlist_format = FOLDERS_ICONS;
169                         break;
170                 case FOLDERS_ICONS:
171                         mwindow->edl->session->folderlist_format = FOLDERS_TEXT;
172                         break;
173         }
174
175         mwindow->awindow->gui->folder_list->update_format(
176                 mwindow->edl->session->folderlist_format, 1);
177         menu->update_titles();
178
179         return 1;
180 }
181
182
183