Commit graph

1168 commits

Author SHA1 Message Date
Eugene Sandulenko
a314def2cc GRAPHICS: MACGUI: Added Header formatting, synced with stripFormatting(), fixed closing formatting 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
32f7eec2c6 GRAPHICS: MACGUI: Remove using of \015 as a binary MacText formatting
It was not used, and moreover \015 is \x0d which is \r. oops
2023-09-17 00:56:28 +02:00
Eugene Sandulenko
ee7573b222 GRAPHICS: MACGUI: Marked Markdown parts with STUB and started real rendering 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
027e3794d3 GRAPHICS: MACGUI: implemented italic and bold Markdown output 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
d69a9689cc GRAPHICS: MACGUI: fix printing out of debug info in Markdown 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
d10f80a8c9 GRAPHICS: MACGUI: Implement equivalent of tag opening and closing for MacText 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
bbc6dbcd10 GRAPHICS: MACGUI: Properly grow buffer for Markdown 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
5719847354 GRAPHICS: MACGUI: Pass setMarkdownText through MacTextWindow 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
f6ffcf3c82 GRAPHICS: MACGUI: Implemented stubs for Markdown parser 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
ce04c4b309 GRAPHICS: MACGUI: Initial stub for MacText::setMarkdownText() 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
115b30779c
GRAPHICS: MACGUI: Fix MacText rendering in 32bpp mode 2023-08-16 01:12:31 +02:00
Wyatt Radkiewicz
41a942c5ce ALL: Renamed TS_ARGB to MS_ARGB 2023-08-13 00:22:10 +02:00
Harishankar Kumar
26aa07c4d4 DIRECTOR: High IDs for custom scrollable border
This patch bumps IDs of scrollable border to 0x1000 and above, so that
they don't conflict with IDs normal borders, additionally to support this
change windowType is changed from `byte` type to `uint32` type.
2023-08-03 09:49:20 +02:00
Harishankar Kumar
442c1a5d41 DIRECTOR: Implement events for scroll type text cast
This patch implements events for scrolltype text cast members, callbacks
in MacTextWindow is used to redirect events to director engine.

`ATD\HD\bbTWRFL2.DXR@392` of 'totaldistortion-win' uses `mouseUp` score
script attached to scrolltype text cast member, which when clicked calls
`getMouseLine` to find the clicked book, thus opening it.
2023-08-03 09:49:20 +02:00
Harishankar Kumar
14c6939a9c GRAPHICS: MACGUI: Execute window _callback in MacTextWindow
This patch ensures that the `_callback` function is executed in the
MacTextWindow class.
2023-08-03 09:49:20 +02:00
Harishankar Kumar
f3a6c27df6 GRAPHICS: MACGUI: Add no-border scrollbar, Win95 Border Refactored
Win95 scrollbar loading is refactored to use existing `borders` array
in `datafiles.cpp`, Added no-border scrollbar for MacOS, Win95.

This is to support scrollable text cast members in Director, which
will be used by `totaldistortion-win` game.
--start-movie="ATD\HD\bbTWRFL2.DXR@392" totaldistortion-win
2023-08-03 09:49:20 +02:00
Harishankar Kumar
a7e737b6e4 GRAPHICS: MACGUI: Implement background window
This patch adds background window, these are special type of window where
the window is always in background and in a multi-window environment, it
will prevent the window from being brought to front.
2023-08-02 18:42:24 +02:00
Harishankar Kumar
9b6d9b0c27 GRAPHICS: Fix WinFont scaling memory leak when scaling fonts.
Memory leak happened because the scaled generated fonts were not
being cached or saved anywhere, thus they were not being destructed
and freed. Added logic to cache generated font in _winFontRegistry
itself.

Leaks observed in `trektech-win` of director engine in first few frames itself.
2023-07-08 22:13:28 +03:00
elasota
229f711ccd GRAPHICS: MACGUI: Load MacFont TTF as monochrome 2023-06-30 10:40:43 +03:00
elasota
bb5ea049d5 GRAPHICS: MACGUI: Constness fixes 2023-06-30 10:40:43 +03:00
BLooperZ
289dfabb42 MACGUI: Encode UTF-8 in windows mode
This fixes hebrew rendering of PDA in Pink
also reverts commit 2fe812db97.
2023-06-29 09:50:04 +03:00
Harishankar Kumar
96008586c6 GRAPHICS: Add scaling for winfont
Allow scaling of window font, ie FON, FNT. Internally this uses
same implementation as BDFScaling and MacFontScaling. Uses function
scaleSingleGlyph to scale each glyph.

Fonts in `mcluhan-win` used some of these fonts where the sizes
were different than parsed.
2023-06-27 13:00:29 +03:00
D G Turner
0e472905ad GRAPHICS: MACGUI: Fix Set But Unused Variable GCC Compiler Warning
These were left over from "Fix alignment issues for multiline text"
recent commit.
2023-06-25 03:44:59 +01:00
Harishankar Kumar
283b5c4b20 GRAPHICS: MACGUI: Fix kMacRoman fonts issues with special characters
This commit removes Mac Roman from plainByteMode(), this partially
reverts commit `9d4ac18be542eed5fdbb52519fd95ea7ac47a9e4` from
PR #3823, this change breaks Hebrew rendering in Pink.

Fixes rendering of texts in `theapartment` using MacRoman fonts.
2023-06-21 20:18:39 +03:00
Harishankar Kumar
b7e09d8259 GRAPHICS: MACGUI: Fix alignment issues for multiline text
This patch fixes the alignment issue for multiline text in text castMember
it increases the line height of each line by one, this added change over
multiple lines result in fixed alignment. This patch also removes the height
reduction due to empty line (which cumulatively caused the alignment issue).

`DATA/SUPPORT/INTRODUCTION@111` of 'warlock-100' has this alignment issue
where the text "The Blaster" was above the button it was supposed to be.
2023-06-21 20:18:39 +03:00
Scott Percival
c94f2de321 DIRECTOR: Add font quirks for two Star Trek games 2023-06-08 09:16:30 +02:00
Harishankar Kumar
797803d515 GRAPHICS: MACGUI: Implement lockable widgets
Lockable widgets are those which takes in all input
and if set then no other widget can take any input
its same as them being inactive, no buttons, animations
etc will work.

This is implemented to support `modal` property of window,
which requires a window to take all input and prevent all
others from having any actions.
2023-06-01 20:17:23 +02:00
Harishankar Kumar
dd72dd09ca DIRECTOR: Implement the titleVisible property of window
Modifies border of window by first changing title to "", then updating
window border to borderType 2 `ThinNoTitle`.

`titleVisible of window` to verify this behavior.

Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18@gmail.com>
2023-06-01 20:17:23 +02:00
Harishankar Kumar
4f07e8dec4 GRAPHICS: MACGUI: Added support to change inner dimension of macwindow derived object
Added setInnerDimension which calls resize (with bool inner dimension change: true), moveto and finally updateOuterDimension.

This was implemented to match window rectangle size as used by window property `rect`, `rect of window` in `workshop` uses this.
2023-05-31 13:29:33 +02:00
Harishankar Kumar
23f1229e67 GRAPHICS: MACGUI: Refactor resize() to extract inner window resizing
resize function is extracted to new function resize and resizeInner,
also a new private function rebuildSurface is created to handle common
code of refreshing/rebuilding surface after modifying inner or outer
window dimensions.
2023-05-31 13:29:33 +02:00
Harishankar Kumar
76d1590ccc GRAPHICS: Implement smartmenu for macpopups
Smartmenu implementation using offsetY to displace popup such that the previous selected item will fall onto cursor, includes checked item and highlighted.

For `Popup Menu` in theapartment, without this patch the second popmenu was not remembering the last selected item and was opening it from scratch, after this patch popupmenu will open from the last selected item already selected with checkbox.
2023-05-28 13:50:18 +02:00
Harishankar Kumar
fd5977b911 GRAPHICS: Add blinking animation when selecting item
Additional logic for drawing blinks when closing popup menu is added, closeMenu is overriden because it is called inside eventLoop and therefore need to be captured when closingMenu.

Add blinking animation support for macpopups, affects `Popup Menu` in theapartment, before this there was no animation when selecting item and the menu just used to immediately close, now however there is proper animation for item selection.
2023-05-28 13:50:18 +02:00
Harishankar Kumar
e12d3053cc GRAPHICS: Implement macpopupmenu while reusing macmenu
Added functions for menu drawing/selections, this uses the base functions of macmenu to implement mac-styled popupmenu's, also return selected item index/text.

Used by 'Popup Menu' in theapartment: With this changes the popupmenu is working with both item selectors, doesn't implement the icon selector.
2023-05-28 13:50:18 +02:00
Harishankar Kumar
014712bbc5 GRAPHICS: Add menu by id and support custom menu
Adds new function addMenu/getMenu with menu id to add custom menus.

Used when implementing macpopupmenu which reuses macmenu for theapartment.
2023-05-28 13:50:18 +02:00
Harishankar Kumar
5bb6e06624 GRAPHICS: Expose internal macmenu structs for reusing in popmenu
Exposed MacMenuItem, MacMenuSubMenu, MacMenuItem and MacMenuData to headers and changed visibility of needed functions to protected.

These structs and functions is used in popupmenu for reusing macmenu code.
2023-05-28 13:50:18 +02:00
Eugene Sandulenko
70b1a4432a
GRAPHICS: MACGUI: Use proper check symbol in MacMenu 2023-05-28 12:54:06 +02:00
Misty De Meo
ce61aa9b9b GRAPHICS: MACGUI: remove unused variable 2023-05-14 12:04:58 +03:00
Scott Percival
14c7756d06 GRAPHICS: MACGUI: Fix edge cases of getMouseWord 2023-03-24 21:27:34 +01:00
Donovan Watteau
18ab6803d6 JANITORIAL: Fix various "an" typos in comments 2023-03-16 14:47:28 +01:00
Scott Percival
585ec558b6 GRAPHICS: MACGUI: Move getFont() messages to a higher debug level 2023-03-06 21:26:28 +01:00
Roland van Laar
157b1d9a48 GRAPHICS: MACGUI: keep formatting in empty text
When text is emptied by user action, e.g. backspace, the formattting
should be preserved.

In the game Majestic a text box for user input would start out with the
correct formatting, i.e. green text on a black background. When the user
would then press backspace till the text was gone, the method
`MacText::getTextChunk` would return an empty string, with the
formatting removed. If the user started typing again the text would use
the default formatting with black text on black background.

Fixes: https://trello.com/c/POQZRCEO/546-text-doesnt-show-in-majestic-in-text-box
2023-02-17 15:02:52 +01:00
Roland van Laar
d33005f8b2 JANITORIAL: GRAPHICS: print fgcolor in base 10
All colors in debug output in mactext use base 10
where this line was in base 16.
2023-02-17 15:02:52 +01:00
Eugene Sandulenko
39f1b97fb9
GRAPHICS: MACGUI: Clean up "-Regular" prefix from the loaded MacFonts
Usage is in mcluhan quirk where we load font named "McLuhan-Regular"
2023-02-10 23:51:14 +01:00
Eugene Sandulenko
980e927e57
GRAPHICS: MACGUI: Warn about incorrect winfont sizes used as a substitute
Used by mcluhan-win that has 3 fonts bundled with it.
2023-02-10 20:59:30 +01:00
Eugene Sandulenko
e5c1ef3fbb
DIRECTOR: Fix regression from 48740a2ad1
The color values went inverted, but in several places they left
untouched.

In general, it is not a good idea to have this hardcoded, but at least
now we have this addressed.
2023-02-10 00:53:38 +01:00
Cameron Cawley
28d7b361ea COMMON: Move more file format code into common/formats 2022-12-11 22:33:23 +01:00
Eugene Sandulenko
fb7095f5a4
COMMON: Move all compression-related files to a separate directory 2022-12-01 11:53:02 +01:00
elasota
261ced8ca4 GRAPHICS: Fix getRowCol returning uninitialized variable nsx if there were no chunks for the chosen line. 2022-11-28 18:43:55 +01:00
Hubert Maier
a3ec89bf51 JANITORIAL: GRAPHICS: Correct Spelling Mistake
begining -> beginning
2022-11-15 22:52:43 +02:00
sluicebox
2775987cba MACGUI: Expose font families in MacFontManager
MacFontManager didn't have a mechanism to report which fonts it loaded
from an external resource. It also requires that any fonts that aren't
built-in be explicitly registered by name by the client before they can
be used. This combination meant that a client couldn't load fonts from
an external file and use them by their properties (id / size / style).

SCI contains Mac fonts in its executable along with a table that maps
each SCI font id to a Mac font id and size. The font name isn't a part
of this since the Classic Mac Toolbox API took id / size / style as
input when drawing text.

Now MacFontManager exposes the font families it has loaded along with
their names. This allows a client to see which fonts were loaded,
register them by name, and proceed to use them with the existing API.
2022-11-06 23:05:20 -08:00