merge: fixes to speed autos, draw float autos, edit params, render format tool
[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                 session->folderlist_format = FOLDERS_ICONS;
90                 break;
91         case ASSETS_ICONS:
92                 session->assetlist_format = ASSETS_TEXT;
93                 session->folderlist_format = FOLDERS_TEXT;
94                 break;
95         }
96
97         agui->asset_list->update_format(session->assetlist_format, 1);
98         agui->folder_list->update_format(session->folderlist_format, 1);
99         if (!mwindow->awindow->gui->allow_iconlisting) {
100                 mwindow->edl->session->assetlist_format = ASSETS_TEXT;
101         }
102
103         agui->start_vicon_drawing();
104         return 1;
105 }
106
107
108
109
110 AssetListSort::AssetListSort(MWindow *mwindow)
111  : BC_MenuItem(_("Sort items"))
112 {
113         this->mwindow = mwindow;
114 }
115
116 int AssetListSort::handle_event()
117 {
118         mwindow->awindow->gui->sort_assets();
119         return 1;
120 }
121
122
123
124
125 FolderListMenu::FolderListMenu(MWindow *mwindow, AWindowGUI *gui)
126  : BC_PopupMenu(0,
127                 0,
128                 0,
129                 "",
130                 0)
131 {
132         this->mwindow = mwindow;
133         this->gui = gui;
134 }
135
136 FolderListMenu::~FolderListMenu()
137 {
138 }
139
140 void FolderListMenu::create_objects()
141 {
142         add_item(format = new FolderListFormat(mwindow, this));
143         update_titles();
144 }
145
146
147
148 void FolderListMenu::update_titles()
149 {
150         format->set_text(mwindow->edl->session->folderlist_format == FOLDERS_TEXT ?
151                 (char*)_("Display icons") : (char*)_("Display text"));
152 }
153
154
155
156
157
158
159
160 FolderListFormat::FolderListFormat(MWindow *mwindow, FolderListMenu *menu)
161  : BC_MenuItem("")
162 {
163         this->mwindow = mwindow;
164         this->menu = menu;
165 }
166 int FolderListFormat::handle_event()
167 {
168         switch(mwindow->edl->session->folderlist_format)
169         {
170                 case FOLDERS_TEXT:
171                         mwindow->edl->session->assetlist_format = ASSETS_ICONS;
172                         mwindow->edl->session->folderlist_format = FOLDERS_ICONS;
173                         break;
174                 case FOLDERS_ICONS:
175                         mwindow->edl->session->assetlist_format = ASSETS_TEXT;
176                         mwindow->edl->session->folderlist_format = FOLDERS_TEXT;
177                         break;
178         }
179
180         mwindow->awindow->gui->asset_list->update_format(
181                 mwindow->edl->session->folderlist_format, 1);
182         mwindow->awindow->gui->folder_list->update_format(
183                 mwindow->edl->session->folderlist_format, 1);
184         menu->update_titles();
185
186         return 1;
187 }
188
189
190