3 * Copyright (C) 2016-2020 William Morrow
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 #include "arraylist.h"
29 #include "mwindow.inc"
30 #include "swindow.inc"
32 #define SUB_FORMAT_SRT 1
33 #define SUB_FORMAT_RIP 2
34 #define SUB_FORMAT_UDVD 3
36 class SWindow : public Thread
49 int update_selection();
52 SWindow(MWindow *mwindow);
57 class SWindowOK : public BC_OKButton
62 int button_press_event();
65 SWindowOK(SWindowGUI *gui, int x, int y);
69 class SWindowCancel : public BC_CancelButton
74 int button_press_event();
76 SWindowCancel(SWindowGUI *gui, int x, int y);
80 class SWindowLoadPath : public BC_TextBox
85 SWindowLoadPath(SWindowGUI *gui, int x, int y, char *path);
91 class SWindowLoadFile : public BC_GenericButton
98 SWindowLoadFile(SWindowGUI *gui, int x, int y);
102 class SWindowSaveFile : public BC_GenericButton
109 SWindowSaveFile(SWindowGUI *gui, int x, int y);
113 class SWindowItemFormat : public BC_MenuItem
116 SWindowItemFormat(SWindowSaveFormat *save_format, const char *text, int id);
119 SWindowSaveFormat *save_format;
123 class SWindowSaveFormat : public BC_PopupMenu
126 SWindowSaveFormat(SWindowGUI *sw_gui, int x, int y);
127 void create_objects();
128 void update_toggles();
131 SWindowItemFormat *srt;
132 SWindowItemFormat *rip;
133 SWindowItemFormat *udvd;
143 void append(char *cp);
144 int size() { return used; }
147 char *get_text_row(int n);
153 class ScriptScroll : public BC_ScrollBar
160 ScriptScroll(SWindowGUI *gui, int x, int y, int w);
164 class ScriptPosition : public BC_TumbleTextBox
171 ScriptPosition(SWindowGUI *gui, int x, int y, int w, int v=0, int mn=0, int mx=0);
175 class ScriptEntry : public BC_ScrollTextBox
181 void set_text(char *text, int isz=-1);
184 ScriptEntry(SWindowGUI *gui, int x, int y, int w, int rows, char *text);
185 ScriptEntry(SWindowGUI *gui, int x, int y, int w, int rows);
189 class ScriptPrev : public BC_GenericButton
195 ScriptPrev(SWindowGUI *gui, int x, int y);
199 class ScriptNext : public BC_GenericButton
205 ScriptNext(SWindowGUI *gui, int x, int y);
209 class ScriptPaste : public BC_GenericButton
215 ScriptPaste(SWindowGUI *gui, int x, int y);
219 class ScriptClear : public BC_GenericButton
225 ScriptClear(SWindowGUI *gui, int x, int y);
229 class SWindowGUI : public BC_Window
231 static int max(int a,int b) { return a>b ? a : b; }
235 BC_CancelButton *cancel;
236 SWindowLoadPath *load_path;
237 SWindowLoadFile *load_file;
238 SWindowSaveFile *save_file;
239 SWindowSaveFormat *save_format;
240 BC_Title *script_filesz;
241 BC_Title *script_lines;
242 BC_Title *script_entries;
243 BC_Title *script_texts;
244 BC_Title *script_title;
245 BC_Title *line_title;
246 ScriptPrev *prev_script;
247 ScriptNext *next_script;
248 ScriptPaste *paste_script;
249 ScriptClear *clear_script;
250 ScriptPosition *script_position;
251 ScriptEntry *script_entry;
252 ScriptEntry *line_entry;
253 ScriptScroll *script_scroll;
258 char script_path[BCTEXTLEN];
259 ArrayList<ScriptLines *> script;
261 void create_objects();
264 int translation_event();
265 int resize_event(int w, int h);
266 void load_defaults();
267 void save_defaults();
269 void load_script(FILE *fp);
270 int load_script_line(FILE *fp);
271 void set_script_pos(int64_t entry_no, int text_no=0);
272 int load_selection();
273 int load_selection(int pos, int row);
274 int load_prev_selection();
275 int load_next_selection();
276 int update_selection();
277 int paste_text(const char *text, double start, double end);
278 int paste_selection();
279 int clear_selection();
280 void save_spumux_data();
282 int ok_x, ok_y, ok_w, ok_h;
283 int cancel_x, cancel_y, cancel_w, cancel_h;
284 int64_t script_entry_no, script_text_no;
285 int64_t script_line_no, script_text_lines;
286 int text_font, text_rowsz;
288 SWindowGUI(SWindow *swindow, int x, int y, int w, int h);
294 class SubttlSWin : public BC_MenuItem
300 SubttlSWin(MWindow *mwindow);