Commit Graph

132 Commits (0ecd922df400531210814ff514e2006ca9a29eec)

Author SHA1 Message Date
Darkvater 41c6c79a25 (svn r7635) -Fix (r7618, r7621): Guard against recursive deletion. It is possible that when a
parent window is deleted it deletes its child (always) and in turn, through some
 code the child initiates the deletion of the parent which, if not guarded
 against, deletes the child and so on...
18 years ago
Darkvater d78d12fdfe (svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
will block activity for the parent window until the modal popup is dismissed.
18 years ago
Darkvater 684ec92c19 (svn r7618) -Feature: Add support for a parent<>child relationship in Window terms. A child
is a window whose parent pointer is non-null. Deleting the parent cascades deleting
 the children as well; children first.
18 years ago
Darkvater daf71e7ef8 (svn r7616) -Cleanup:
-(re)set _rename_[id/what] to -1 to catch invalid calls (main_gui.c)
 -Only invalidate widget of pause/ff instead of whole window (main_gui.c)
 -Remove numbering from WE_ and WC_ as it's not needed, also remove
  non-existing windowclasses (window.h, openttd.h)
 -Give names to some of the enums (window.h)
 -In UninitWindowSystem not only free malloc'd widgets, but also reset the z-array (window.c)
 -Some coding style, comments, etc.
18 years ago
Darkvater 04628a1979 (svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
use in debug.h. grfmsg() is now used as a specific debug-function for grf.
18 years ago
Darkvater 6049734c06 (svn r7414) -Fix: Immediately invalidate the resize widget when clicked, instead of when started to drag 18 years ago
Darkvater 7e23667bbe (svn r7409) -Codechange: Make the ResizeWindow function also available outside of window.c. This makes
it possible to programmatically resize windows specifying a delta x,y.
18 years ago
rubidium 292aeae137 (svn r7356) -Codechange: replace 'for (i = 0, wi = w->widget; wi->type != WWT_LAST; i++, wi++)' type for loops with 'for (i = 0; i < w->window_count; i++) { wi = &w->widget[i];'-type for loops for better readability.
-Codechange: use IsWindowWidget(Disabled|Hidden) in favor of IsWidget(Disabled|Hidden).
18 years ago
rubidium c1220546c4 (svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops 18 years ago
rubidium d832b9c388 (svn r7352) -Codechange: add widget_count parameter to the window.
-Codechange: check whether widget indices are valid for all the (Set|Is)WindowWidget(Disabled|Lowered|Hidden) and related functions.
18 years ago
Darkvater fc1a90b663 (svn r7313) -Codechange: Calling invalidate data on a window will surely warrant a redraw, so call
that after the WE_INVALIDATE_DATA event and remove (some of) the superflouous calls.
18 years ago
Darkvater 1f4e4cc9f1 (svn r7233) -Codechange: get rid of three console.c globals 18 years ago
Darkvater 53b02577b9 (svn r7219) -Fix: Several warnings by gcc introduced in r7206 which MSVC found not of a problem. Thanks Tron 18 years ago
Darkvater e9905dec80 (svn r7207) -Codechange: Pass the (unchanged) windowpointer to the console window and do it only once. 18 years ago
Darkvater c01c294afb (svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
structs inside their array, and possibly invalidating pointers higher up.
 Meaning that any function called within an wndproc could cause unknown/invalid pointers
 once control was returned to this function. Solved by the introduction of an extra
 abstraction layer, an array of z-window positions that is only concerned with the
 pointers.
18 years ago
Darkvater 62a9d7fdf3 (svn r7202) -Codechange: Move _viewports and _active_viewports local to viewport.c and have them
called from the appropiate places in window.c
18 years ago
Darkvater a448474f21 (svn r7201) -Codechange: Use goto's to loop _windows when there is a change you need to start over 18 years ago
Darkvater 1a87a33911 (svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
instead of _windows loop (viewport.c), remove dump-code (mixer.c), MSVC6 borkdness
 in stdafx.h, constness (viewport.c), variable localization (win32.c), comments (window.c)
18 years ago
peter1138 f660d48e6a (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come. 18 years ago
Darkvater acc87fc9f0 (svn r7157) -Fix [FS#221, SF1168820]: Some mouse events possibly lost under high CPU load, handle
mouse input right away instead of waiting for GameLoop. (KUDr)
18 years ago
Darkvater 3328ceea9e (svn r7156) -Codechange: Remove obsolete variable, localize global variable, use GB and change logic
of the win32: TAB speeds up, but ALT+TAB doesn't code.
18 years ago
Darkvater eaddac35be (svn r7153) -Fix [FS#279]: Some keyboard events possibly lost under high CPU load, handle
keyboard input in place instead of global variables magic. (KUDr)
18 years ago
bjarni 0724b07575 (svn r7138) -Fix: [vehicle list windows] fixed a rare crash where having some (not all) vehicle list windows open for a player, that goes bankrupt would crash the game
-Codechange: closing all windows for a player will now loop all windows and close those, which got the player as caption instead of having a list of windows to close
18 years ago
Darkvater cab930041a (svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
some special values (WDP_) instead of checking window-class. This also fixes FS#172
 now that we can position windows arbitrarily and are not restricted to window-classes.
18 years ago
Darkvater 73b8d80036 (svn r7129) -Codechange: Get rid of a global variable that only sets a window's number. 18 years ago
Darkvater 1f45f5ffb3 (svn r7092) -Codechange: Add function to send a window message to a whole class of windows,
SendWindowMessageClass().
18 years ago
Darkvater cfb361ad08 (svn r6961) -Codechange: Remove relic from r212 WWT_NODISTXTBTN which was originally used to not
to allow clicking if a button was disabled. This has been superseded in r212 with
 general code that doesn't allow any click events for disabled buttons.
18 years ago
Darkvater c7c65ce6d5 (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
WWT_IMGBTN must contain an image for drawing. Renamed WWT_PANEL_2 to WWT_IMGBTN_2
 because that is what it is. Added WWT_PUSHBTN that is either just a pushable button,
 or a textbutton, which text's drawn dynamically independent of widget.
18 years ago
bjarni bc1070654a (svn r6680) -Codechange r6679: [train build window] only generate the list when the window data is invalidated or the window is generated, not on each redraw 18 years ago
glx b6b73f7089 (svn r6671) -Fix r6670: typo :P 18 years ago
glx df7f11c70f (svn r6670) -Fix r6669: SetWindowWidgetsDisableState() should disable widgets, not hide them 18 years ago
glx 8f5c6ff3a1 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call 18 years ago
belugas 3b6bb44eef (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
The functions required to do so are to be found in window.h.
Rather then use the old deprecated disabled_state, hidden_state and click_state uint32 variables,
we now need to use accessors like SetWindowWidgetDisabledState, SetWindowWidgetHiddenState or SetWindowWidgetLoweredState.
This is the final commit for the merge of XTDwidget branch.
18 years ago
bjarni b31bfb25ca (svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
This gives the ability to invalidate some window data and recalculate as needed instead of doing it for each WE_PAINT

   This event is called right away when using InvalidateWindowData(), so it may be a good idea to set a bool or similar in the window
     or similar and then act on that bool in WE_PAINT instead of doing a lot of stuff in WE_INVALIDATE_DATA as it might be called more than once before WE_PAINT is called

   InvalidateWindowData() will not automatically repaint the window, so if you want to repaint it as well, you need to mark it dirty as well.

   Made the depot windows use WE_INVALIDATE_DATA to set when to generate the engine and wagon lists instead of at each redraw
   It makes no sense to regenerate the list when say using the scrollbar if we know that no vehicle have entered or left the list

   NOTE: currently there is a piece of code to generate the list when it's not needed and compare it to the stored list and assert if they mismatch
    This check is somewhat slow and kills the whole idea of WE_INVALIDATE_DATA, so it's a short lived one to verify that InvalidateWindowData() is used everywhere where it's needed
18 years ago
belugas 688da1d940 (svn r6631) -Codechange: Use accessors for click_state.
Another step toward merging XTDwidget.
The only two files not converted (window.h and widget.c) will be done at the very last commit)
18 years ago
belugas 98ba395277 (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct 18 years ago
rubidium 21ac20aeca (svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
-Cleanup: whitespace alignment of a few tables.
18 years ago
bjarni ab523bb59f (svn r6345) -Codechange: AllocateWindowDescFront() now ensures that window_number is set before calling the WE_CREATE event
this allows using the window_number in WE_CREATE window event handlers
18 years ago
truelight a824598367 (svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
-Codechange: use always 'e' for WindowsEvent, neverr 'we'
18 years ago
truelight f6b17149c6 (svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this. 18 years ago
truelight 7abad2b20e (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
  - Load heightmaps (either BMP or PNG)
  - Progress dialog while generating worlds (no longer a 'hanging' screen)
  - New dialogs for NewGame, Create Scenario and Play Heightmap
    - Easier to configure your landscape
    - More things to configure (tree-placer, ..)
  - Speedup of world generation
  - New console command 'restart': restart the map EXACTLY as it was when you
      first started it (needs a game made after or with this commit)
  - New console command 'getseed': get the seed of your map and share it with
      others (of course only works with generated maps)
  - Many new, world generation related, things
  - Many internal cleanups and rewrites
  Many tnx to those people who helped making this:
     Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
  Many tnx to those who helped testing:
     Arnau, Bjarni, and tokai (alfabetic)
  And to all other people who helped testing and sending comments / bugs
  Stats: 673 lines changed, 3534 new lines, 79 new strings
18 years ago
belugas 40a8964911 (svn r5609) CodeChange : Apply coding style 18 years ago
tron 772fbda3e3 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular 18 years ago
tron a2362674e3 (svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc. 18 years ago
celestar 69e1c716e8 (svn r4249) -Codechange: Replace more occurences of 16 by TILE_SIZE and of 8 by TILE_HEIGHT. Reverted one change from the previous commit because it was faulty 19 years ago
tron 087fe86ed2 (svn r3564) Several smaller changes:
- Don't treat non-booleans as booleans
- Reduce variable scope
- Bracing
- Use DeMorgan's law to make conditionals easier to read
- if cascade -> switch
- Replace some magic numbers by symbolic names
- Avoid assignments within other statements
19 years ago
tron 1c3e8630fe (svn r3511) More whitespace ([FS#46] by Rubidium) 19 years ago
tron 9712d6f639 (svn r3510) Fiddle with whitespace and parentheses 19 years ago
Darkvater 1e51c18c93 (svn r3425) - Fix: Followup to r3421. Correctly reset the TileHighLightData structure to prevent crashes in all the other cases where it is not guarded against sufficiently 19 years ago
tron 318fe153eb (svn r3365) Staticise 36 functions 19 years ago