~akirad/cinecutie/trunk

« back to all changes in this revision

Viewing changes to cinecutie/awindowmenu.C

  • Committer: Paolo Rampino
  • Date: 2010-02-17 19:46:21 UTC
  • Revision ID: git-v1:c39ff77ffa6ae08441c12e7d7f54e3897ddde7f1
Initial Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
        switch(mwindow->edl->session->assetlist_format)
 
83
        {
 
84
                case ASSETS_TEXT:
 
85
                        mwindow->edl->session->assetlist_format = ASSETS_ICONS;
 
86
                        break;
 
87
                case ASSETS_ICONS:
 
88
                        mwindow->edl->session->assetlist_format = ASSETS_TEXT;
 
89
                        break;
 
90
        }
 
91
 
 
92
        
 
93
        if (!mwindow->awindow->gui->allow_iconlisting) {
 
94
                mwindow->edl->session->assetlist_format = ASSETS_TEXT;
 
95
        }
 
96
 
 
97
        mwindow->awindow->gui->asset_list->update_format(
 
98
                mwindow->edl->session->assetlist_format, 
 
99
                1);
 
100
 
 
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 ASSETS_TEXT:
 
168
                        mwindow->edl->session->folderlist_format = ASSETS_ICONS;
 
169
                        break;
 
170
                case ASSETS_ICONS:
 
171
                        mwindow->edl->session->folderlist_format = ASSETS_TEXT;
 
172
                        break;
 
173
        }
 
174
 
 
175
        mwindow->awindow->gui->folder_list->update_format(mwindow->edl->session->folderlist_format, 1);
 
176
        menu->update_titles();
 
177
 
 
178
        return 1;
 
179
}
 
180
 
 
181
 
 
182