1 #include "bcdisplayinfo.h"
5 #include "mainsession.h"
7 #include "preferences.h"
13 // Table of tips of the day
16 N_("When configuring slow effects, disable playback for the track. After configuring it,\n"
17 "re-enable playback to process a single frame."),
19 N_("Ctrl + any transport command causes playback to only cover\n"
20 "the region defined by the in/out points."),
22 N_("Shift + clicking a patch causes all other patches except the\n"
23 "selected one to toggle."),
25 N_("Clicking on a patch and dragging across other tracks causes\n"
26 "the other patches to match the first one."),
28 N_("Shift + clicking on an effect boundary causes dragging to affect\n"
29 "just the one effect."),
31 N_("Load multiple files by clicking on one file and shift + clicking on\n"
32 "another file. Ctrl + clicking toggles individual files."),
34 N_("Ctrl + left clicking on the time bar cycles forward a time format.\n"
35 "Ctrl + middle clicking on the time bar cycles backward a time format."),
37 N_("Use the +/- keys in the Compositor window to zoom in and out.\n"),
39 N_("Pressing Alt while clicking in the cropping window causes translation of\n"
42 N_("Pressing Tab over a track toggles the Record status.\n"
43 "Pressing Shift-Tab over a track toggles the Record status of all the other tracks.\n"),
45 N_("Audio->Map 1:1 maps each recordable audio track to a different channel.\n"
46 "Map 5.1:1 maps 6 recordable AC3 tracks to 2 channels.\n"),
48 N_("Alt + left moves to the previous edit handle.\n"
49 "Alt + right moves to the next edit handle.\n")
52 static int total_tips = sizeof(tips) / sizeof(char*);
57 TipWindow::TipWindow(MWindow *mwindow)
60 this->mwindow = mwindow;
63 BC_Window* TipWindow::new_gui()
65 BC_DisplayInfo display_info;
66 int x = display_info.get_abs_cursor_x();
67 int y = display_info.get_abs_cursor_y();
68 TipWindowGUI *gui = this->gui = new TipWindowGUI(mwindow,
72 gui->create_objects();
76 char* TipWindow::get_current_tip()
78 CLAMP(mwindow->session->current_tip, 0, total_tips - 1);
79 char *result = _(tips[mwindow->session->current_tip]);
80 mwindow->session->current_tip++;
81 if(mwindow->session->current_tip >= total_tips)
82 mwindow->session->current_tip = 0;
83 mwindow->save_defaults();
87 void TipWindow::next_tip()
89 gui->tip_text->update(get_current_tip());
92 void TipWindow::prev_tip()
94 for(int i = 0; i < 2; i++)
96 mwindow->session->current_tip--;
97 if(mwindow->session->current_tip < 0)
98 mwindow->session->current_tip = total_tips - 1;
101 gui->tip_text->update(get_current_tip());
109 TipWindowGUI::TipWindowGUI(MWindow *mwindow,
113 : BC_Window(PROGRAM_NAME ": Tip of the day",
124 this->mwindow = mwindow;
125 this->thread = thread;
128 void TipWindowGUI::create_objects()
132 add_subwindow(tip_text = new BC_Title(x, y, thread->get_current_tip()));
135 BC_CheckBox *checkbox;
136 add_subwindow(checkbox = new TipDisable(mwindow, this, x, y));
139 y = get_h() - TipClose::calculate_h(mwindow) - 10;
140 x = get_w() - TipClose::calculate_w(mwindow) - 10;
141 add_subwindow(button = new TipClose(mwindow, this, x, y));
143 x -= TipNext::calculate_w(mwindow) + 10;
144 add_subwindow(button = new TipNext(mwindow, this, x, y));
146 x -= TipPrev::calculate_w(mwindow) + 10;
147 add_subwindow(button = new TipPrev(mwindow, this, x, y));
149 x += button->get_w() + 10;
155 int TipWindowGUI::keypress_event()
157 switch(get_keypress())
174 TipDisable::TipDisable(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
177 mwindow->preferences->use_tipwindow,
178 _("Show tip of the day."))
180 this->mwindow = mwindow;
184 int TipDisable::handle_event()
186 mwindow->preferences->use_tipwindow = get_value();
192 TipNext::TipNext(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
195 mwindow->theme->get_image_set("next_tip"))
197 this->mwindow = mwindow;
199 set_tooltip(_("Next tip"));
201 int TipNext::handle_event()
203 gui->thread->next_tip();
207 int TipNext::calculate_w(MWindow *mwindow)
209 return mwindow->theme->get_image_set("next_tip")[0]->get_w();
217 TipPrev::TipPrev(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
218 : BC_Button(x, y, mwindow->theme->get_image_set("prev_tip"))
220 this->mwindow = mwindow;
222 set_tooltip(_("Previous tip"));
225 int TipPrev::handle_event()
227 gui->thread->prev_tip();
230 int TipPrev::calculate_w(MWindow *mwindow)
232 return mwindow->theme->get_image_set("prev_tip")[0]->get_w();
243 TipClose::TipClose(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
244 : BC_Button(x, y, mwindow->theme->get_image_set("close_tip"))
246 this->mwindow = mwindow;
248 set_tooltip(_("Close"));
251 int TipClose::handle_event()
257 int TipClose::calculate_w(MWindow *mwindow)
259 return mwindow->theme->get_image_set("close_tip")[0]->get_w();
261 int TipClose::calculate_h(MWindow *mwindow)
263 return mwindow->theme->get_image_set("close_tip")[0]->get_h();