1 #include "bcdisplayinfo.h"
5 #include "mainsession.h"
7 #include "preferences.h"
13 // Table of tips of the day
16 "When configuring slow effects, disable playback for the track. After configuring it,\n"
17 "re-enable playback to process a single frame.",
19 "Ctrl + any transport command causes playback to only cover\n"
20 "the region defined by the in/out points.",
22 "Shift + clicking a patch causes all other patches except the\n"
23 "selected one to toggle.",
25 "Clicking on a patch and dragging across other tracks causes\n"
26 "the other patches to match the first one.",
28 "Shift + clicking on an effect boundary causes dragging to affect\n"
29 "just the one effect.",
31 "Load multiple files by clicking on one file and shift + clicking on\n"
32 "another file. Ctrl + clicking toggles individual files.",
34 "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 "Use the +/- keys in the Compositor window to zoom in and out.\n",
39 "Pressing Alt while clicking in the cropping window causes translation of\n"
42 "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"
46 static int total_tips = sizeof(tips) / sizeof(char*);
51 TipWindow::TipWindow(MWindow *mwindow)
54 this->mwindow = mwindow;
57 BC_Window* TipWindow::new_gui()
59 BC_DisplayInfo display_info;
60 int x = display_info.get_abs_cursor_x();
61 int y = display_info.get_abs_cursor_y();
62 TipWindowGUI *gui = this->gui = new TipWindowGUI(mwindow,
66 gui->create_objects();
70 char* TipWindow::get_current_tip()
72 CLAMP(mwindow->session->current_tip, 0, total_tips - 1);
73 char *result = tips[mwindow->session->current_tip];
74 mwindow->session->current_tip++;
75 if(mwindow->session->current_tip >= total_tips)
76 mwindow->session->current_tip = 0;
77 mwindow->save_defaults();
81 void TipWindow::next_tip()
83 gui->tip_text->update(get_current_tip());
86 void TipWindow::prev_tip()
88 for(int i = 0; i < 2; i++)
90 mwindow->session->current_tip--;
91 if(mwindow->session->current_tip < 0)
92 mwindow->session->current_tip = total_tips - 1;
95 gui->tip_text->update(get_current_tip());
103 TipWindowGUI::TipWindowGUI(MWindow *mwindow,
107 : BC_Window(PROGRAM_NAME ": Tip of the day",
118 this->mwindow = mwindow;
119 this->thread = thread;
122 void TipWindowGUI::create_objects()
126 add_subwindow(tip_text = new BC_Title(x, y, thread->get_current_tip()));
129 BC_CheckBox *checkbox;
130 add_subwindow(checkbox = new TipDisable(mwindow, this, x, y));
133 y = get_h() - TipClose::calculate_h(mwindow) - 10;
134 x = get_w() - TipClose::calculate_w(mwindow) - 10;
135 add_subwindow(button = new TipClose(mwindow, this, x, y));
137 x -= TipNext::calculate_w(mwindow) + 10;
138 add_subwindow(button = new TipNext(mwindow, this, x, y));
140 x -= TipPrev::calculate_w(mwindow) + 10;
141 add_subwindow(button = new TipPrev(mwindow, this, x, y));
143 x += button->get_w() + 10;
149 int TipWindowGUI::keypress_event()
151 switch(get_keypress())
168 TipDisable::TipDisable(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
171 mwindow->preferences->use_tipwindow,
172 _("Show tip of the day."))
174 this->mwindow = mwindow;
178 int TipDisable::handle_event()
180 mwindow->preferences->use_tipwindow = get_value();
186 TipNext::TipNext(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
189 mwindow->theme->get_image_set("next_tip"))
191 this->mwindow = mwindow;
193 set_tooltip(_("Next tip"));
195 int TipNext::handle_event()
197 gui->thread->next_tip();
201 int TipNext::calculate_w(MWindow *mwindow)
203 return mwindow->theme->get_image_set("next_tip")[0]->get_w();
211 TipPrev::TipPrev(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
212 : BC_Button(x, y, mwindow->theme->get_image_set("prev_tip"))
214 this->mwindow = mwindow;
216 set_tooltip(_("Previous tip"));
219 int TipPrev::handle_event()
221 gui->thread->prev_tip();
224 int TipPrev::calculate_w(MWindow *mwindow)
226 return mwindow->theme->get_image_set("prev_tip")[0]->get_w();
237 TipClose::TipClose(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
238 : BC_Button(x, y, mwindow->theme->get_image_set("close_tip"))
240 this->mwindow = mwindow;
242 set_tooltip(_("Close"));
245 int TipClose::handle_event()
251 int TipClose::calculate_w(MWindow *mwindow)
253 return mwindow->theme->get_image_set("close_tip")[0]->get_w();
255 int TipClose::calculate_h(MWindow *mwindow)
257 return mwindow->theme->get_image_set("close_tip")[0]->get_h();