Commit Graph

125 Commits (2d2290296d69bc4636e228983b5fa5f0c5708b96)

Author SHA1 Message Date
rubidium 4c855b4613 (svn r7700) -Fix (r7182): the caret 'randomly' jumped back and forth when getting a new randomised seed in the Generation World GUI. 18 years ago
Darkvater c87fcab772 (svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
query has no parent (eg give money, rename waypoint), the global function
 HandleOnEditText is used.
18 years ago
Darkvater 18524958aa (svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
a parent pointer which will be blocked as long as the popup is open. This
 applies to newgrf-apply, heightmap warning, genworld progress.
18 years ago
Darkvater 17f42ef491 (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 49eb2a91ab (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 649b25bd11 (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 cf385cccf3 (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 9a87e1e0ea (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 05559bcdcd (svn r7353) -Codechange: constify Window* in IsWindowWidget(Lowered|Hidden|Disabled) 18 years ago
rubidium c02e39945e (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 f40eccae9b (svn r7314) -Cleanup: const, whitespace, coding style and variable usage. 18 years ago
KUDr 1235172cc7 (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
- using one engine list instead of 3
- removed engine filters (loco, wagons, helicopters, etc.)
- EngineList code isolated from GUI (moved to helpers.cpp - reusing CBlobT code which does exactly what is needed for EngineList)
- removed unnecessary  "optimization" (rebuild and sort engine list on each WE_PAINT)
18 years ago
Darkvater b3c48c0a84 (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 aa97b61a27 (svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3) 18 years ago
Darkvater c4d841dcdb (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 1a4f1c8177 (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 a353e354fd (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 3a03b70319 (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 ed46b7d380 (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 47e7ad7771 (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 21db9ebb8e (svn r7129) -Codechange: Get rid of a global variable that only sets a window's number. 18 years ago
Darkvater 45366b4372 (svn r7092) -Codechange: Add function to send a window message to a whole class of windows,
SendWindowMessageClass().
18 years ago
Darkvater 64a2205517 (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 1e69ac550d (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
for the aptly found name)
-Codechange: Remove the explicit numbering from WindowWidgetTypes
18 years ago
Darkvater d303ef94b3 (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
Darkvater 2d48fd2861 (svn r6821) -Codechange: For the measurement tool do not show the tooltip when the selection
is only a single tile. Seems this was a bit annoying to some ;)
18 years ago
Darkvater 0ae642b914 (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
differences of various draggable tools (inspiration, concept and double
 checking by MeusH).
18 years ago
bjarni ba2be75c0c (svn r6722) -Codechange: [aircraft build window] moved aircraft build window to a file of it's own
Also made some changes to it so it should be easier to unify all the build vehicle windows
18 years ago
bjarni 08789dd3e8 (svn r6712) -Code cleanup: renamed buildtrain_d to buildvehicle_d as it's used for all vehicle types 18 years ago
bjarni b8e1f70751 (svn r6707) -Feature: [build aircraft window] added buttons to view propeller planes, jet planes or helicopters
-Codechange: the build aircraft window now generates 3 malleced lists and displays based on those list
    This is preparation for sorting aircraft
18 years ago
bjarni de504592a8 (svn r6684) -Feature: [train build window] added sorting options for the engines 18 years ago
bjarni 208e258f4c (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
bjarni db66567799 (svn r6679) -Feature: [train build window] added filter for wagons, engines or both in the display
-Codechange: [train build window] to get rid of a really ugly hack, the train build list is now generated in one loop and stored in an array
18 years ago
glx 30e0a8e952 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call 18 years ago
belugas 67b88e7ed9 (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 ea075f78e0 (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
glx 384a8be1cc (svn r6642) -Fix r6639: 2 conversions missed 18 years ago
belugas 6444b0e781 (svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard 18 years ago
belugas 17eb65050b (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
bjarni ea63050d5f (svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
Example: make a train transport iron ore from A to B, then it visits a depot and refits to steel
     It then transport steel back to A or near A if there is a factory and then it visits another depot to refit to iron ore again

   This is controlled in the orders. If a goto depot order is lightlighted, then "Unload" changes to "Refit"
   Control click "Refit" removes the refit part of the order (as the tooltip says)
   The player will still pay the normal refit costs

   Known issues:
      If a vehicle is not in a depot, then the refit window will fail to tell refitted cargo capacity
      Refit costs in the refit window can sometimes print 0 when it should not because the refit calculation is unaware that the vehicle will be refitted in between

   Warning: autoreplace got a protection against replacing something so you get a new cargo type, but it can fail here. In the iron ore/steel example, it can see that
      the vehicle carries iron ore and the new one can be refitted to iron ore, then it will replace. It will not check to see that it's valid for steel as well.
      This is something to look into in the future
18 years ago
peter1138 406d756c6f (svn r6602) - Feature: we now support NewGRF livery refits, as used by DBsetXL, amongst others. This requires a savegame bump to save the cargo subtype. 18 years ago
peter1138 2de71bc234 (svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch) 18 years ago
belugas 4ebb3857e7 (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
This is the first step toward merging XTDwidget.
18 years ago
bjarni f7769e885e (svn r6513) -Codechange: unified the code to draw depot windows
This change is intended to make it easier to make depot behaviour consistent
   and faster to code when adding more features in the future
   The user interface should hopefully not be affected by this
18 years ago
bjarni 8f4a4a81da (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
This will ensure that you can always get the same list when checking for vehicles in a depot (no need to duplicate code for each place, that needs such a list)
   Since the vehicles are only looped once for each redraw, drawing speed is around twice as fast (measured to be 114%-121% faster depending on the number of vehicles in the game)
18 years ago
belugas 1c56a5ae0f (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct 18 years ago
Darkvater 56d06ba0a7 (svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'. 18 years ago
Darkvater 794cc6d55e (svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
-Codechange: Unify the Sorting struct both for vehicle-lists and network-lists.
18 years ago
bjarni 01a566429c (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
tron 96f9a0ad7b (svn r6210) Remove FR_NOBORDER, because it is exclusivly used in conjunction with FR_TRANSPARENT 18 years ago