8 #define _(String) gettext(String)
9 #define gettext_noop(String) String
10 #define N_(String) gettext_noop (String)
13 LoadModeItem::LoadModeItem(char *text, int value)
14 : BC_ListBoxItem(text)
20 LoadMode::LoadMode(MWindow *mwindow,
21 BC_WindowBase *window,
27 this->mwindow = mwindow;
28 this->window = window;
31 this->output = output;
32 this->use_nothing = use_nothing;
33 if(use_nothing) load_modes.append(new LoadModeItem(_("Insert nothing"), LOAD_NOTHING));
34 load_modes.append(new LoadModeItem(_("Replace current project"), LOAD_REPLACE));
35 load_modes.append(new LoadModeItem(_("Replace current project and concatenate tracks"), LOAD_REPLACE_CONCATENATE));
36 load_modes.append(new LoadModeItem(_("Append in new tracks"), LOAD_NEW_TRACKS));
37 load_modes.append(new LoadModeItem(_("Concatenate to existing tracks"), LOAD_CONCATENATE));
38 load_modes.append(new LoadModeItem(_("Paste at insertion point"), LOAD_PASTE));
39 load_modes.append(new LoadModeItem(_("Create new resources only"), LOAD_RESOURCESONLY));
47 for(int i = 0; i < load_modes.total; i++)
48 delete load_modes.values[i];
51 int LoadMode::calculate_h(BC_WindowBase *gui)
53 return BC_TextBox::calculate_h(gui, MEDIUMFONT, 1, 1);
56 char* LoadMode::mode_to_text()
58 for(int i = 0; i < load_modes.total; i++)
60 if(load_modes.values[i]->value == *output)
61 return load_modes.values[i]->get_text();
66 int LoadMode::create_objects()
68 int x = this->x, y = this->y;
70 default_text = mode_to_text();
72 window->add_subwindow(title = new BC_Title(x, y, _("Insertion strategy:")));
74 window->add_subwindow(textbox = new BC_TextBox(x,
76 mwindow->theme->loadmode_w,
79 x += textbox->get_w();
80 window->add_subwindow(listbox = new LoadModeListBox(window, this, x, y));
88 result = MAX(result, title->get_h());
89 result = MAX(result, textbox->get_h());
103 int LoadMode::reposition_window(int x, int y)
107 title->reposition_window(x, y);
109 textbox->reposition_window(x, y);
110 x += textbox->get_w();
111 listbox->reposition_window(x,
113 mwindow->theme->loadmode_w);
118 LoadModeListBox::LoadModeListBox(BC_WindowBase *window,
124 loadmode->mwindow->theme->loadmode_w,
127 (ArrayList<BC_ListBoxItem *>*)&loadmode->load_modes,
134 this->window = window;
135 this->loadmode = loadmode;
138 LoadModeListBox::~LoadModeListBox()
142 int LoadModeListBox::handle_event()
144 if(get_selection(0, 0) >= 0)
146 loadmode->textbox->update(get_selection(0, 0)->get_text());
147 *(loadmode->output) = ((LoadModeItem*)get_selection(0, 0))->value;