Minor changes, mostly to documentation. Several bug fixes.
[xuni.git] / TODO
blob0426f86917fbe0f1247ec8d2546f8462a27de2e4
1 === TODO list for xuni, in chronological order.
3 [done] Handle SDL_VIDEOEXPOSE instead of repainting the whole menu every screen. This could involve passing paint_menu() et al information about which part of the screen to repaint.
5 [done] Create a settings file which saves the screen mode etc. strtol() is a good idea.
7 [done] theme_t::boxw and theme_t::boxh are currently just shortcuts for box[0].corners.image->[wh]. Should the corners of buttons all be the same size? If not, should there be get_button_corner_size() functions, complicated inline code, or separate images like box[x].upperleftcorner?
9 Currently, the entire screen is repainted when fullscreen is toggled, whether or not it succeeded in any way. Perhaps the screen does not need to be repainted if SDL_WM_ToggleFullScreen() succeeds?
11 [done -- see error.c::log_message()] The warning messages are vague at best. Perhaps a varargs print_warning() etc is in order?
13 Currently, load_icon() frees the SDL_Surface it passes to SDL_WM_SetIcon(). This is good for this system, because Valgrind shows a memory leak otherwise. But is this standard?
15 [done -- see ~/perl/func_need_be_unstatic.pl] Determine which functions ought to be static and make them so.
17 [done] Split graphics.c up into several files -- it's too long and complicated.
19 [done] De-obfuscate paint_button().
21 [done] Allow paint_button() to be passed the width (and height?) of the button.
23 [done] Should the frame rate change according to the mode? Since the menu does not paint all of the time, it could be running at twice the FPS. The menu could even use SDL_WaitEvent() and not be frame-limited at all . . .
25 [done] Check to make sure that the return value of set_graphics_mode() is always used, as toggle_fullscreen() does.
27 Pass specific information to SDL_UpdateRect to repaint only a widget if that is all that has changed.
29 [changed] The screen doesn't need repainting upon an SDL_MOUSEBUTTONUP event inside a checkbox widget.
31 [done] Handle SDL_ActiveEvent in the game loop, and pause if neccessary.
33 [done] Should keys repeat? It makes using SDL_KEYDOWN (which is more natural as opposed to SDL_KEYUP) tough to use to detect menu keys etc. Maybe its setting could change between screens?
35 [done] Add support for using the keyboard to navigate menus.
37 [done] Use a pointer to a widget when the mouse is held down as well as when a widget is selected (like a textbox). This will require changing struct smode_t.
39 [done] Move screen into struct smode_t? Or use SDL_GetVideoSurface() all of the time? (Otherwise normal functions can't toggle fullscreen etc.)
41 [done, used function pointers] Get rid of all of those unused parameters. Either that or use some function pointers.
43 [done -- it was "repaint ||" instead of "|| repaint" in loop.c] Fix the app-focus bugs for all platforms.
45 [possible] Add an option to init_checkbox() to make the checkbox just the right width.
47 Create a help source file. (Textareas should be implemented before doing this.)
49 [done] Have a "previous text" member for textboxes, so that when escape is pressed they may revert to their former text.
51 Add a "disabled" widget artwork set?
53 Separating artwork for different widgets? (Textbox art is counter-intuitive with button/box artwork.)
55 [added] Some typedefs, especially one for bool, might not be a bad idea. (fullscreen, enabled, checked, ...)
57 [decided otherwise] Add code to detect if xuni is running way below the proper FPS; and if it is, forgo delaying entirely?
59 [done, with libexpat] Use libxml2 instead of or in addition to settings.c?
61 Actually write out the settings back to .xuni -- but only if they have changed? Or just write the settings file immediately after every change? (Bad if a change crashes the program, for example, a screen mode that is too large.)
63 [done] Add in support for using SDL_gfx's SDL_gfxPrimitives_font.h instead of SDL_ttf, eliminating dependency on one of the only required external resources, a font?
65 Create a proper strings_t data structure, possibly much like codeform's; as well as a more complicated one which supports text editing (scrolling, arrow keys, insertion, remembering where the cursor is, restoring the old data when escape is pressed, etc).
67 [fixed by elimination] Bug: when the xuni window is resized, many strange things occur, such as textboxes resetting to their original text. (To fix this, init_textbox() must not set the data of the textbox.)
69 Separate the gui/widget code from the xuni code as much as possible -- maybe even make it a separate library eventually. This might entail:
70     [done] Creating a widget_array_t structure to dynamically hold allocated widgets. (This would allow external configuration files to change the gui layout etc.) [important]
71     [re-written] Simplifying the code which detects if a widget is active. (set_menu_widget_sel(), ...)
72     Allowing different box types, such as a stretched image for the centre, to allow a textured box image. This could be done by making paint_box() etc create a new SDL_Surface.
73     [done with function pointers] Rather than each frame having its own set_*_widget_sel() etc, find a way to describe this with data or function pointers.
75 Improve the gui/widget code itself:
76     [done] Allow widgets to be disabled; such widgets would not do anything when the mouse clicked on them. (Widgets would be allowed to switch between enabled and disabled states, of course.)
77     [barely started] Allow only specified widgets to be repainted instead of repainting the whole screen when only one widget needs it.
79 Only count a button as clicked if the mouse is over an opaque part of the button? [What about, e.g., alpha=1?]
81 [irrelevant, used strings] Use consistent and unique ids for widgets.
83 [done, used panel_type_t] Unify loop_mode_t, options_mode_t, game_mode_t, and panel_type_t.
85 [obsolete] Have post-settings which apply after menu_data, game_data, and options_data have been initialized, to support mainmenu.quality?
87 Somehow allow different themes for different panels? (For example, shadow for the main menu and outline elsewhere.)
89 [done -- see xuni_t] Put all structures (smode_t, theme_t, font_t, gui_t, etc) into one structure?
91 If SDL_SetVideoMode() is called a second time, and fails, is the previous SDL_Surface pointer still valid? try_resizing_screen() assumes so.
93 Use an SDL_FilterEvent function instead of loop.c's process_event()?
95 [done] Use the default cursor if cursor.png could not be loaded.
97 [almost done, old cursor not erased] Re-enable the default cursor if the window focus is lost.
99 [done] Implement a simple garbage collector?
101 Convert the TODO file to a more readable format.
103 Widgets to consider adding include: tooltips, [done] comboboxes, spinners, [done] scrollbars, progress bars . . . .
105 [done: free_widget() and rescale_widget()] Split free_widget() into fake, when-the-window-is-being-resized freeing and real, genuine, complete freeing code. Otherwise there are issues because real freeing must recurse into composite widgets, while fake freeing should not. (Either that or introduce yet another parameter . . . int all, int fake . . . .)
107 [done] Create an archive, libxuni.a.
109 Implement an undo/redo tree instead of just undo/redo? (Would be very difficult, but very impressive.)
111 [done with hack, bug not fixed] Check for focus whenever the screen is resized.
113 [done] Store all information in structures that is required to resize widgets automatically -- including text and positions.
115 [done] Develop a method of representing complex resizable positions -- a whole new coordinate system, really.
117 [done] Create "text" and "image" widgets, and make the theme menu's fontsample as well as the main menu's code into widgets. (Maybe not the background, as it is never resized.)
119 [done] Specify checkboxes as composite text and button widgets.
121 [done] Detect keydowns and only handle escape etc for matching keyups? (Otherwise, pressing ALT-TAB-SHIFT-TAB-ESCAPE registers an escape keypress in xuni.)
123 Determine where widget_t::compose and widget_t::pos need to be checked against NULL. (Make widget_t::pos a structure once more instead of a pointer?)
125 [semi-done -- used xuni_t instead] Create a structure to pass to each panel-handling function -- i.e. one for init_func_t, one for start_func_t, etc.
127 [done] Allow left-aligned as well as centre-aligned labels.
129 Allow click repeating, for scrollbars?
131 [done] Move what is really scrollbar code out of listbox sections.
133 [done] Make overlapping widgets work.
135 [interpolation] Where did menu.c's mysterious .69 come from?
137 [done] Hide the check images of checkboxes when they are not checked.
139 [done] Modify WIDGET_LABEL for use in textboxes.
141 [started] Fix the offset bugs for listboxes and textboxes.
143 Make all widgets clip-able, perhaps with SDL_SetClipRect().
145 [done, see GARBAGE_COLLECT_ALL] In memory.c, only keep track of blocks with more than one pointer to them; i.e., make xuni_memory_increment() add the block to the list, but not xuni_memory_allocate(). This will result in imperfect garbage detection but much less memory used.
147 [done, not debugged properly] Make memory.c handle "volatile" data such as resizable SDL_Surfaces, and then eliminate WIDGET_IMAGE_POINTER.
149 [done] Make gui->panel into a widget -- this would simplify widget searching, freeing, etc.
151 [done] Eliminate the need to put "/box" at the end of button widget names.
153 [done, not enforced] Make widget percentages relative to the parent widget instead of the whole screen; perhaps use SDL_SetClipRect() to enforce it.
155 [started -- listboxes work correctly] Add widget packing, to allow listboxes to work correctly.
157 Make parameters const where possible.
159 Bug: when the cursor is changed from fancy to normal, it jumps to the previous normal position.
161 [done, for clicking at least] Allow accelerator keys for widgets.
163 Figure out why Valgrind reports so many errors like "invalid read"s.
165 [made the default] Allow <includehere> tags that include a resource file, putting it in the same place in the tree as the tag itself.
167 Allow resource tags to reference other tags, to help congregate duplicated information.
169 [done] Implement theme panels, so that the theme can be changed by using a different theme panel.
171 [why?] Need to be able to specify absolute positions.
173 [done with repositioning] Make listboxes more efficient -- right now, every listbox item is resized whenever the listbox is scrolled!
175 [virtually done] Make struct xuni_t *xuni the first parameter of all functions it is passed to.
177 The widget_t::pos pointer could be NULL on occasion -- the default would probably be (0,0) by (100,100).
179 [done] Use KEYDOWN for detection of ESCAPE etc instead of KEYUP, to allow key repeating and so that keypresses from other windows are not caught by accident.
181 [done] Remove SDL_resize from the project, Makefiles, etc.
183 [started] Support an internal default theme.
185 [fixed temporarily] Functions like options_theme_deactivate() are receiving clicks on their panel, which is stored in a different nameid[] structure, and so messes up the click detection. (Click on the options theme panel, and the fullscreen checkbox is toggled.)
187 [started] Implement cumulative widget offsets somehow -- one clip_pos_t just isn't enough. Perhaps putting a function callback for every type of widget in reposition_widget() would do it. This function would then be called when the real positions needed modifying.
189 Use SDL_USEREVENT code?
191 [fixed] When one textbox is deactivated with the same click that another is activated, the string of the original textbox is lost.
193 [done] Make disabled buttons work once again.
195 [done] When a widget is deactivated via loss of focus, deactivate_widget() should be called instead of revert_widget() -- see clear_active().
197 Check for unused parameters for functions that do not get assigned to function pointers.
199 [done] Make free_widget() use callback functions.
201 Have a statically-initialized loading panel? (And a quitting one? That would not necessarily need to be static.) Threads would make this much easier.
203 [done] Make the logfile customizable and/or disableable by xuni applications.
205 Make logfiles widgets?
207 Call xuni_memory_increment() and free_widget() on struct widget_t *fonts.
209 [mostly done for widgets] Alphabetize things -- widgets, header files, possibly even functions.
211 [started -- for labels only] Implement coloured text.
213 Use the "active" box artwork for a widget activated by a widget accelerator?
215 Profile xuni to find out what takes so much CPU when resizing the window etc. (TTF_RenderText_Blended()?)
217 Reduce the number of functions main()/WinMain() has to call.
219 Add a WIDGET_XUNI, and have an icon etc? Or make icons part of themes?
221 Improve calc.y's error reporting.
223 [not possible -- flex uses FILE* streams] Implement "true" and "false" in calc.y -- this will require re-writing the tokenizer, or using [f]lex.
225 Use the SGE, for dynamic image rescaling and dynamic text rendering, amongst other things.
227 [done, by using size_t instead of struct widget_t *] Need to implement a theme switching callback or something, to allow labels to switch to a new theme's font.
229 [done] When the font is changed and a different theme is active, all label font pointers remain pointing to the alienglow theme's fonts, not those of the current theme. This needs to be fixed somehow.
231 [started] Implement listbox selection.
233 Allow the resource editor to add buttons anywhere; position widgets based on percentages [started]; and save [started] and load resource files.
235 Implement textarea widgets.
237 [almost done] Scroll textboxes properly.
239 [started] Make scrollbar and combobox buttons square.
241 Allow images and other widgets in listboxes.
243 Standardize WID system somehow.
245 Allow single-image boxes.
247 [done] Make resource file paths relative to the resource file, not to the xuni executable. [Except for the initial resource file path, of course.]
249 Rename all public functions to xuni_*().
251 Implement menus.
253 Allow moveable panels (windows)?
255 [done a bit kludgishly] Have an "editing" cursor when hovering over textboxes.
257 Implement clipboard features, possibly interfacing with native system clipboard.
259 Make text aspect ratio match the aspect ratio of the window?
261 Test a widget with a width of over 100%.
263 [done] Make scrollbars use percentages instead of absolute values?
265 Bug: pressing ALT-F4 causes deactivate_widget() to be called instead of revert_widget().
267 [pretty much done] Redo fonts, making them separate from themes.
269 xuni occasionally crashes when nothing inside a listbox is clicked on -- perhaps because of the way listboxes start out with weird scroll values.
271 Need to have a type for positions, not just "int" or even "Uint16" or anything. And probably not "pos_t", which conflicts with "struct pos_t".
273 allocated_sdl_surface() does not return the same for newly allocated and about-to-be-freed surfaces, which is why the memory count is out of wack.
275 [started] Figure out why listboxes must be rescaled twice when new items are added to them, and fix it so that they can be rescaled only once.
277 [done] Make listbox scrolling more efficient -- label images are still generated every time.
279 [fixed] The entire widget tree does not have to be resized when a theme is switched.
281 Find out why listbox data positions must be width/2 for example.
283 Image tile widgets do not scroll at the same rate in different screen modes. This is because the inc values (which are ints and should be doubles) are taken as absolute pixel values instead of percentages.
285 Fix the static theme code.
287 [done] Make font changing work in all themes.
289 Widget tabbing is implemented very tentatively, and does not work on checkboxes etc, because they do not have a direct compose box object. They have buttons which have boxes, but box.c doesn't handle this.
291 Widget activation does not work on those panels which have nameids in different panels, such as the options theme panel.
293 [done] Invent an event system like the SDL's?
295 Implement support for another graphics library besides the SDL?
297 [done] Load images only when they actually need to be repainted?
299 [done, with widget_t::selwidget] paint_widget() is now called instead of set_box_type() + paint_box_previous_state(). Boxes need to store which widget affects whether they are selected or not. Since they do not do this, disabled buttons no longer work -- again.
301 Multi-modifer accelerator keys, like "shift" and "alt", do not work properly.
303 Have start_*() set the title to "Quitting . . ."?
305 [done] Use the GNU autotools for xuni's build system?
307 [done] Implement support for resource loading with libmxml.
309 Need to have a way to specify which widget's dimensions are used when determining whether a widget is hovered or not. This would simplify determining whether a button is selected or not, as well as checkboxes (see paint_box()).
311 When or if the coordinate system is reworked, also add support for "just the right size" -- i.e., just as packing automatically determines positions, there should be a way to automatically decide widths and heights. As wide as possible is already done with width/height 100, but as narrow as possible is not.
313 Make settings_t dynamically allocated and move it into xuni_t to make initializing xuni easier.
315 Move selwidget out of widget_t and into box_t?
317 Handle certain event types in loop.c if they are not handled by the xuni application, such as SDL_QUIT.
319 When the cursor changes from enabled to disabled, and the cursor moves between frames, it jumps down to the lower right corner of the screen. The SDL_WarpMouse() trick doesn't work for this.
321 The cursor also "jumps" whenever fullscreen is toggled.
323 There is a bug with font switching which causes items in scrolled listboxes to move upwards twice as much as they should.
325 Need to either make fonts specific to each theme, or have one global font, or something.
327 textbox_t::text is not used at the moment. Perhaps it should be eliminated.
329 Listbox data panels are offset according to the roundness of the current theme. When the roundness changes, they need to be moved, in rescale_listbox() most likely.
331 A text cursor needs to be painted when textboxes are empty.
333 When textboxes revert, the text jumps to the end. This is because clear_active() calls rescale_label(): here, reposition_label_data() is only called when it needs to be.
335 When the mouse selects a character that is only partially visible, the textbox text needs to scroll so that this character is fully visible.
337 Make the images for the glowbox theme smaller.
339 Need to test call_blit_surface().