=== Overview ===
[xuni.git] / TODO
blob259d1d7c08bcb46b06eec1781f34af79efecc824
1 ---- Current todo list ----
2 [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.
4 [done] Create a settings file which saves the screen mode etc. strtol() is a good idea.
6 [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?
8 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?
10 [done -- see error.c::log_message()] The warning messages are vague at best. Perhaps a varargs print_warning() etc is in order?
12 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?
14 [done -- see ~/perl/func_need_be_unstatic.pl] Determine which functions ought to be static and make them so.
16 [done] Split graphics.c up into several files -- it's too long and complicated.
18 [done] De-obfuscate paint_button().
20 [done] Allow paint_button() to be passed the width (and height?) of the button.
22 [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 . . .
24 [done] Check to make sure that the return value of set_graphics_mode() is always used, as toggle_fullscreen() does.
26 Pass specific information to SDL_UpdateRect to repaint only a widget if that is all that has changed.
28 [changed] The screen doesn't need repainting upon an SDL_MOUSEBUTTONUP event inside a checkbox widget.
30 [done] Handle SDL_ActiveEvent in the game loop, and pause if neccessary.
32 [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?
34 [done] Add support for using the keyboard to navigate menus.
36 [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.
38 [done] Move screen into struct smode_t? Or use SDL_GetVideoSurface() all of the time? (Otherwise normal functions can't toggle fullscreen etc.)
40 [done, used function pointers] Get rid of all of those unused parameters. Either that or use some function pointers.
42 [done -- it was "repaint ||" instead of "|| repaint" in loop.c] Fix the app-focus bugs for all platforms.
44 [possible] Add an option to init_checkbox() to make the checkbox just the right width.
46 Create a help source file. (Textareas should be implemented before doing this.)
48 [done] Have a "previous text" member for textboxes, so that when escape is pressed they may revert to their former text.
50 Add a "disabled" widget artwork set?
52 Separating artwork for different widgets? (Textbox art is counter-intuitive with button/box artwork.)
54 [added] Some typedefs, especially one for bool, might not be a bad idea. (fullscreen, enabled, checked, ...)
56 [decided otherwise] Add code to detect if xuni is running way below the proper FPS; and if it is, forgo delaying entirely?
58 [done, with libexpat] Use libxml2 instead of or in addition to settings.c?
60 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.)
62 [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?
64 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).
66 [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.)
68 Separate the gui/widget code from the xuni code as much as possible -- maybe even make it a separate library eventually. This might entail:
69     [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]
70     [re-written] Simplifying the code which detects if a widget is active. (set_menu_widget_sel(), ...)
71     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.
72     [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.
74 Improve the gui/widget code itself:
75     [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.)
76     [barely started] Allow only specified widgets to be repainted instead of repainting the whole screen when only one widget needs it.
78 Only count a button as clicked if the mouse is over an opaque part of the button? [What about, e.g., alpha=1?]
80 [irrelevant, used strings] Use consistent and unique ids for widgets.
82 [done, used panel_type_t] Unify loop_mode_t, options_mode_t, game_mode_t, and panel_type_t.
84 [obsolete] Have post-settings which apply after menu_data, game_data, and options_data have been initialized, to support mainmenu.quality?
86 Somehow allow different themes for different panels? (For example, shadow for the main menu and outline elsewhere.)
88 [done -- see xuni_t] Put all structures (smode_t, theme_t, font_t, gui_t, etc) into one structure?
90 If SDL_SetVideoMode() is called a second time, and fails, is the previous SDL_Surface pointer still valid? try_resizing_screen() assumes so.
92 Use an SDL_FilterEvent function instead of loop.c's process_event()?
94 [done] Use the default cursor if cursor.png could not be loaded.
96 [almost done, old cursor not erased] Re-enable the default cursor if the window focus is lost.
98 [done] Implement a simple garbage collector?
100 Convert the TODO file to a more readable format.
102 Widgets to consider adding include: tooltips, [done] comboboxes, spinners, [done] scrollbars, progress bars . . . .
104 [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 . . . .)
106 [done] Create an archive, libxuni.a.
108 Implement an undo/redo tree instead of just undo/redo? (Would be very difficult, but very impressive.)
110 [done with hack, bug not fixed] Check for focus whenever the screen is resized.
112 [done] Store all information in structures that is required to resize widgets automatically -- including text and positions.
114 [done] Develop a method of representing complex resizable positions -- a whole new coordinate system, really.
116 [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.)
118 [done] Specify checkboxes as composite text and button widgets.
120 [done] Detect keydowns and only handle escape etc for matching keyups? (Otherwise, pressing ALT-TAB-SHIFT-TAB-ESCAPE registers an escape keypress in xuni.)
122 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?)
124 [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.
126 [done] Allow left-aligned as well as centre-aligned labels.
128 Allow click repeating, for scrollbars?
130 [done] Move what is really scrollbar code out of listbox sections.
132 [done] Make overlapping widgets work.
134 [interpolation] Where did menu.c's mysterious .69 come from?
136 [done] Hide the check images of checkboxes when they are not checked.
138 [done] Modify WIDGET_LABEL for use in textboxes.
140 [started] Fix the offset bugs for listboxes and textboxes.
142 Make all widgets clip-able, perhaps with SDL_SetClipRect().
144 [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.
146 [done, not debugged properly] Make memory.c handle "volatile" data such as resizable SDL_Surfaces, and then eliminate WIDGET_IMAGE_POINTER.
148 [done] Make gui->panel into a widget -- this would simplify widget searching, freeing, etc.
150 [done] Eliminate the need to put "/box" at the end of button widget names.
152 [done, not enforced] Make widget percentages relative to the parent widget instead of the whole screen; perhaps use SDL_SetClipRect() to enforce it.
154 [started -- listboxes work correctly] Add widget packing, to allow listboxes to work correctly.
156 Make parameters const where possible.
158 Bug: when the cursor is changed from fancy to normal, it jumps to the previous normal position.
160 [done, for clicking at least] Allow accelerator keys for widgets.
162 Figure out why Valgrind reports so many errors like "invalid read"s.
164 Allow <includehere> tags that include a resource file, putting it in the same place in the tree as the tag itself.
166 Allow resource tags to reference other tags, to help congregate duplicated information.
168 [done] Implement theme panels, so that the theme can be changed by using a different theme panel.
170 Need to be able to specify absolute positions.
172 Make listboxes more efficient -- right now, every listbox item is resized whenever the listbox is scrolled!
174 Make struct xuni_t *xuni the first parameter of all functions it is passed to.
176 The widget_t::pos pointer could be NULL on occasion -- the default would probably be (0,0) by (100,100).
178 [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.
180 [done] Remove SDL_resize from the project, Makefiles, etc.
182 [started] Support an internal default theme.
184 [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.)
186 [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.
188 Use SDL_USEREVENT code?
190 [fixed] When one textbox is deactivated with the same click that another is activated, the string of the original textbox is lost.
192 [done] Make disabled buttons work once again.
194 [done] When a widget is deactivated via loss of focus, deactivate_widget() should be called instead of revert_widget() -- see clear_active().
196 Check for unused parameters for functions that do not get assigned to function pointers.
198 [done] Make free_widget() use callback functions.
200 Have a statically-initialized loading panel? (And a quitting one? That would not necessarily need to be static.) Threads would make this much easier.
202 [done] Make the logfile customizable and/or disableable by xuni applications.
204 Make logfiles widgets?
206 Call xuni_memory_increment() and free_widget() on struct widget_t *fonts.
208 Alphabetize things -- widgets, header files, possibly even functions.
210 [started -- for labels only] Implement coloured text.
212 Use the "active" box artwork for a widget activated by a widget accelerator?
214 Profile xuni to find out what takes so much CPU when resizing the window etc. (TTF_RenderText_Blended()?)
216 Reduce the number of functions main()/WinMain() has to call.
218 Add a WIDGET_XUNI, and have an icon etc? Or make icons part of themes?
220 Improve calc.y's error reporting.
222 Implement "true" and "false" in calc.y -- this will require re-writing the tokenizer, or using [f]lex.
224 Use the SGE, for dynamic image rescaling and dynamic text rendering, amongst other things.
226 Need to implement a theme switching callback or something, to allow labels to switch to a new theme's font.
228 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.
230 [started] Implement listbox selection.
232 Allow the resource editor to add buttons anywhere; position widgets based on percentages; and save and load resource files.
234 Implement textarea widgets.
236 Scroll textboxes properly.
238 [started] Make scrollbar and combobox buttons square.
240 Allow images and other widgets in listboxes.
242 Standardize WID system somehow.
244 Allow single-image boxes.
246 Make resource file paths relative to the resource file, not to the xuni executable.
248 Rename all public functions to xuni_*().
250 Implement menus.
252 Allow moveable panels (windows)?
254 [done kludgishly] Have an "editing" cursor when hovering over textboxes.
256 Implement clipboard features, possibly interfacing with native system clipboard.
258 Make text aspect ratio match the aspect ratio of the window?
260 Test a widget with a width of over 100%.
262 Make scrollbars use percentages instead of absolute values?
264 Bug: pressing ALT-F4 causes deactivate_widget() to be called instead of revert_widget().
266 [pretty much done] Redo fonts, making them separate from themes.
268 xuni occasionally crashes when nothing inside a listbox is clicked on -- perhaps because of the way listboxes start out with weird scroll values.
270 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".
272 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.
274 [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.
276 Make listbox scrolling more efficient -- label images are still generated every time.
278 [fixed] The entire widget tree does not have to be resized when a theme is switched.
280 Find out why listbox data positions must be width/2 for example.
282 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.
284 Fix the static theme code.
286 Make font changing work in all themes.
288 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.
290 Widget activation does not work on those panels which have nameids in different panels, such as the options theme panel.
292 Invent an event system like the SDL's?
294 Implement support for another graphics library besides the SDL?
296 Load images only when they actually need to be repainted?
298 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.
300 Multi-modifer accelerator keys, like "shift" and "alt", do not work properly.
302 Have start_*() set the title to "Quitting . . ."?
304 Use the GNU autotools for xuni's build system?
306 [done] Implement support for resource loading with libmxml.
308 ---- External bugs discovered ----
309 The only member of the structure located in file:///usr/share/doc/libsdl1.2-dev/docs/html/sdlexposeevent.html is missing a semicolon.
311 In file:///usr/share/doc/libsdl1.2-dev/docs/html/sdlexposeevent.html, the description belongs with SDL_QUITEVENT:
312     SDL_ExposeEvent -- Quit requested event