00001 #include "bcdisplayinfo.h"
00002 #include "bcsignals.h"
00003 #include "keys.h"
00004 #include "language.h"
00005 #include "mainsession.h"
00006 #include "mwindow.h"
00007 #include "preferences.h"
00008 #include "theme.h"
00009 #include "tipwindow.h"
00010
00011
00012
00013
00014 static char *tips[] =
00015 {
00016 N_("When configuring slow effects, disable playback for the track. After configuring it,\n"
00017 "re-enable playback to process a single frame."),
00018
00019 N_("Ctrl + any transport command causes playback to only cover\n"
00020 "the region defined by the in/out points."),
00021
00022 N_("Shift + clicking a patch causes all other patches except the\n"
00023 "selected one to toggle."),
00024
00025 N_("Clicking on a patch and dragging across other tracks causes\n"
00026 "the other patches to match the first one."),
00027
00028 N_("Shift + clicking on an effect boundary causes dragging to affect\n"
00029 "just the one effect."),
00030
00031 N_("Load multiple files by clicking on one file and shift + clicking on\n"
00032 "another file. Ctrl + clicking toggles individual files."),
00033
00034 N_("Ctrl + left clicking on the time bar cycles forward a time format.\n"
00035 "Ctrl + middle clicking on the time bar cycles backward a time format."),
00036
00037 N_("Use the +/- keys in the Compositor window to zoom in and out.\n"),
00038
00039 N_("Pressing Alt while clicking in the cropping window causes translation of\n"
00040 "all 4 points.\n"),
00041
00042 N_("Pressing Tab over a track toggles the Record status.\n"
00043 "Pressing Shift-Tab over a track toggles the Record status of all the other tracks.\n"),
00044
00045 N_("Audio->Map 1:1 maps each recordable audio track to a different channel.\n"
00046 "Map 5.1:1 maps 6 recordable AC3 tracks to 2 channels.\n"),
00047
00048 N_("Alt + left moves to the previous edit handle.\n"
00049 "Alt + right moves to the next edit handle.\n")
00050 };
00051
00052 static int total_tips = sizeof(tips) / sizeof(char*);
00053
00054
00055
00056
00057 TipWindow::TipWindow(MWindow *mwindow)
00058 : BC_DialogThread()
00059 {
00060 this->mwindow = mwindow;
00061 }
00062
00063 BC_Window* TipWindow::new_gui()
00064 {
00065 BC_DisplayInfo display_info;
00066 int x = display_info.get_abs_cursor_x();
00067 int y = display_info.get_abs_cursor_y();
00068 TipWindowGUI *gui = this->gui = new TipWindowGUI(mwindow,
00069 this,
00070 x,
00071 y);
00072 gui->create_objects();
00073 return gui;
00074 }
00075
00076 char* TipWindow::get_current_tip()
00077 {
00078 CLAMP(mwindow->session->current_tip, 0, total_tips - 1);
00079 char *result = _(tips[mwindow->session->current_tip]);
00080 mwindow->session->current_tip++;
00081 if(mwindow->session->current_tip >= total_tips)
00082 mwindow->session->current_tip = 0;
00083 mwindow->save_defaults();
00084 return result;
00085 }
00086
00087 void TipWindow::next_tip()
00088 {
00089 gui->tip_text->update(get_current_tip());
00090 }
00091
00092 void TipWindow::prev_tip()
00093 {
00094 for(int i = 0; i < 2; i++)
00095 {
00096 mwindow->session->current_tip--;
00097 if(mwindow->session->current_tip < 0)
00098 mwindow->session->current_tip = total_tips - 1;
00099 }
00100
00101 gui->tip_text->update(get_current_tip());
00102 }
00103
00104
00105
00106
00107
00108
00109 TipWindowGUI::TipWindowGUI(MWindow *mwindow,
00110 TipWindow *thread,
00111 int x,
00112 int y)
00113 : BC_Window(PROGRAM_NAME ": Tip of the day",
00114 x,
00115 y,
00116 640,
00117 100,
00118 640,
00119 100,
00120 0,
00121 0,
00122 1)
00123 {
00124 this->mwindow = mwindow;
00125 this->thread = thread;
00126 }
00127
00128 void TipWindowGUI::create_objects()
00129 {
00130 int x = 10, y = 10;
00131 SET_TRACE
00132 add_subwindow(tip_text = new BC_Title(x, y, thread->get_current_tip()));
00133 y = get_h() - 30;
00134 SET_TRACE
00135 BC_CheckBox *checkbox;
00136 add_subwindow(checkbox = new TipDisable(mwindow, this, x, y));
00137 SET_TRACE
00138 BC_Button *button;
00139 y = get_h() - TipClose::calculate_h(mwindow) - 10;
00140 x = get_w() - TipClose::calculate_w(mwindow) - 10;
00141 add_subwindow(button = new TipClose(mwindow, this, x, y));
00142 SET_TRACE
00143 x -= TipNext::calculate_w(mwindow) + 10;
00144 add_subwindow(button = new TipNext(mwindow, this, x, y));
00145 SET_TRACE
00146 x -= TipPrev::calculate_w(mwindow) + 10;
00147 add_subwindow(button = new TipPrev(mwindow, this, x, y));
00148 SET_TRACE
00149 x += button->get_w() + 10;
00150
00151 show_window();
00152 raise_window();
00153 }
00154
00155 int TipWindowGUI::keypress_event()
00156 {
00157 switch(get_keypress())
00158 {
00159 case RETURN:
00160 case ESC:
00161 case 'w':
00162 set_done(0);
00163 break;
00164 }
00165 return 0;
00166 }
00167
00168
00169
00170
00171
00172
00173
00174 TipDisable::TipDisable(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
00175 : BC_CheckBox(x,
00176 y,
00177 mwindow->preferences->use_tipwindow,
00178 _("Show tip of the day."))
00179 {
00180 this->mwindow = mwindow;
00181 this->gui = gui;
00182 }
00183
00184 int TipDisable::handle_event()
00185 {
00186 mwindow->preferences->use_tipwindow = get_value();
00187 return 1;
00188 }
00189
00190
00191
00192 TipNext::TipNext(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
00193 : BC_Button(x,
00194 y,
00195 mwindow->theme->get_image_set("next_tip"))
00196 {
00197 this->mwindow = mwindow;
00198 this->gui = gui;
00199 set_tooltip(_("Next tip"));
00200 }
00201 int TipNext::handle_event()
00202 {
00203 gui->thread->next_tip();
00204 return 1;
00205 }
00206
00207 int TipNext::calculate_w(MWindow *mwindow)
00208 {
00209 return mwindow->theme->get_image_set("next_tip")[0]->get_w();
00210 }
00211
00212
00213
00214
00215
00216
00217 TipPrev::TipPrev(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
00218 : BC_Button(x, y, mwindow->theme->get_image_set("prev_tip"))
00219 {
00220 this->mwindow = mwindow;
00221 this->gui = gui;
00222 set_tooltip(_("Previous tip"));
00223 }
00224
00225 int TipPrev::handle_event()
00226 {
00227 gui->thread->prev_tip();
00228 return 1;
00229 }
00230 int TipPrev::calculate_w(MWindow *mwindow)
00231 {
00232 return mwindow->theme->get_image_set("prev_tip")[0]->get_w();
00233 }
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 TipClose::TipClose(MWindow *mwindow, TipWindowGUI *gui, int x, int y)
00244 : BC_Button(x, y, mwindow->theme->get_image_set("close_tip"))
00245 {
00246 this->mwindow = mwindow;
00247 this->gui = gui;
00248 set_tooltip(_("Close"));
00249 }
00250
00251 int TipClose::handle_event()
00252 {
00253 gui->set_done(0);
00254 return 1;
00255 }
00256
00257 int TipClose::calculate_w(MWindow *mwindow)
00258 {
00259 return mwindow->theme->get_image_set("close_tip")[0]->get_w();
00260 }
00261 int TipClose::calculate_h(MWindow *mwindow)
00262 {
00263 return mwindow->theme->get_image_set("close_tip")[0]->get_h();
00264 }
00265
00266
00267