1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-16 20:19:22 +02:00
Commit Graph

807 Commits

Author SHA1 Message Date
Maarten ter Huurne
9df565b73c Made rect+color the preferred argument style for (filled) rectangle drawing
This is the opposite of the old situation, when the structs were
unraveled.

The definitions for the alternative styles were moved to the header,
so the compiler has more opportunities for optimizing the conversions.
2014-07-19 00:43:06 +02:00
Maarten ter Huurne
dd27cb2e07 Add constructors for RGBAColor 2014-07-19 00:43:06 +02:00
Maarten ter Huurne
5f454a8569 Made strtorgba into a factory method of RGBAColor
The method is RGBAColor::fromString.
2014-07-19 00:43:06 +02:00
Maarten ter Huurne
950518f3a7 Made RGBAColor components 8 bits wide
The values are all in the range 0..255, so storing more than 8 bits
is wasteful.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
2a4b519282 Removed return code from surface drawing methods
Not a single caller actually checked the return codes.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
86ee9955d6 Removed dedicated horizontal line routine
Just draw a 1-pixel-high box instead.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
0810a26589 Removed unnecessary includes of SDL_gfx header
Only surface.cpp actually uses SDL_gfx functions.
2014-07-19 00:43:05 +02:00
Nebuleon Fumika
9c4e97c839 Make the button repeat rate (after the first repetition) a user setting.
This allows for faster scrolling between section links, in file and directory
selectors, and in manuals, without repeatedly pressing buttons.

The setting's unit is repetitions per second. Its default value is set to
10, and anything between 0 (disabled) and 20 (50 ms) is acceptable.

Grabbing &(instance of GMenu2X).confInt["buttonRepeatRate"] is unsafe, because
the storage for the slot may move as the slot is deleted or added. Instead, a
callback jumps back into the context of an InputManager so the value can be
read from a GMenu2X object's configuration.

A GMenu2X object is also passed to InputManager::init.
2014-07-19 00:43:05 +02:00
Nebuleon Fumika
98a63e2940 Fix setting default values for configuration entries.
Previously, one would check the value in &confInt["someKey"] by passing a
reference to it to evalIntConf. However, because this passing of the reference
went through std::unordered_map::operator[], it created a slot with the named
key and initialised its value with the default constructor of int, which
placed 0 there, if it didn't exist. If the value of 0 was acceptable for the
setting, then 0 as the value selected by the user was indistinguishable from
a slot that had been just created and had to be set to its default.

Now, the std::unordered_map is passed along with the key so that evalIntConf
can check whether the key exists and, if it doesn't exist, set the value to
its default.

Include utilities.h in gmenu2x.h instead of the reverse. One type definition
used by utilities.cpp is moved there (ConfIntHash) and for consistency
ConfStrHash is moved there as well.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
0908aa7bb7 Removed support for multi-line text drawing
When trying to test the previous commit, I couldn't find any place in
the application where strings containing newlines are drawn. So I'm
assuming this is an unnecessary feature, until someone comes up with
a test case proving otherwise.

Yeah, I'm too lazy to review all the code that draws text...
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
2effd1fc99 Made multi-line text drawing more efficient
Instead of splitting everything at once, split off one line at a time.
The code could be more compact but I want to avoid using substr on the
very common special case when a string contains no newlines.
2014-07-19 00:43:05 +02:00
Maarten ter Huurne
5c7ca19f4b Don't issue warnings when rendering empty string 2014-07-19 00:43:05 +02:00
Nebuleon Fumika
08fffbff6a Improve performance in Font::writeLine.
Asking FreeType for metrics before asking it for a render, when rendering
would compute the metrics anyway, is wasteful. Now the width of text, for
horizontal alignment purposes, is simply the width of the render.
2014-07-17 02:04:10 +02:00
Nebuleon Fumika
099bd24556 Use the font's suggested line height instead of its ascent and descent.
In well-described fonts, this enables multi-line text (e.g. in manuals) to be
more readable.

The term "height" is also replaced with "line spacing" in Font's code.
2014-07-17 02:03:02 +02:00
Nebuleon Fumika
349e758b3b Load previews from the previews/ subdir of the current dir in selectors.
This does away with per-link selector directories in link files. It is assumed
that, if a user has access to write files to be launched by an application at
some location, he or she also has access to write files in the previews/
subdirectory under it.
2014-07-17 02:02:23 +02:00
Nebuleon Fumika
aca6025533 Selector previews are now shown with alpha 128 and fill the screen.
The alpha change is so that:
* some of the background is still visible, which includes the name of the
  application for which the selector is being called, its description, and
  text in the status bar;
* the preview, if bright, does not obscure the file names too much.

Selector previews are now shown full-screen (320x240) instead of being a
160x160px square on the right.
2014-07-17 02:00:12 +02:00
Nebuleon Fumika
7284104fd1 Fix issues with loading images with alpha disabled.
These issues are fixed:
* loadPNG gave RGBA surfaces unconditionally. Now it gives RGB surfaces if
  its second parameter, defaulting to true, is false. This fixes adding per-
  surface alpha values, because an RGBA surface ignores its per-surface value.
* Surface::loadImage is updated to receive a third parameter, defaulting to
  true, to determine whether alpha is loaded.
* SurfaceCollection::defaultAlpha was never used.
* SurfaceCollection::defaultAlpha defaulted to false, so even if it were used,
  it would have loaded images without alpha.
2014-07-17 01:25:41 +02:00
Maarten ter Huurne
bb7a30d697 Simplify iteration over tokens using std::array 2014-07-17 01:19:18 +02:00
Nebuleon Fumika
4474a42767 Do not construct Font objects that crash gmenu2x if font loading fails.
This commit ensures that a fully constructed Font object will not crash
gmenu2x when it is used, even if loading the font or initialising SDL_ttf
altogether has failed. Instead, it will render no text, but icons and
images are still drawn.

The proper way to signal an error would be to throw an exception and fail
to construct the Font object. However, gmenu2x does not use exceptions.
2014-07-17 00:42:46 +02:00
Nebuleon Fumika
738c296c67 Fix crashes that could occur when keeping two fonts loaded concurrently.
Since 2002-09-03, SDL_ttf performs reference counting on TTF_Init and
TTF_Quit. If two fonts were loaded concurrently via the Font class and
one was destructed, the destructor of the first object would call TTF_Quit,
making the second object unusable. The constructor now calls TTF_Init
unconditionally to prevent this situation.

The reference counting behavior was introduced in this SDL_ttf commit:
http://hg.libsdl.org/SDL_ttf/rev/fc0371908009
2014-07-17 00:42:14 +02:00
Paul Cercueil
c777de258c Greatly improve the French translation 2014-07-15 14:25:17 +02:00
Paul Cercueil
917cbf7208 Various changes related to translations 2014-07-15 14:25:17 +02:00
Paul Cercueil
5e22dd5941 Remove the 'Show root' option, which didn't do anything 2014-07-15 14:25:17 +02:00
Paul Cercueil
c72266d771 Remove the 'Selector alias file' feature
Who seriously used that?
2014-07-15 14:25:17 +02:00
Maarten ter Huurne
9e113d88c7 Fixed compilation with GCC 4.9 2014-05-18 21:19:03 +02:00
Paul Cercueil
fe1a586fb3 Don't consider *.dge files as being executables 2014-05-17 13:56:16 +02:00
Paul Cercueil
dac1e49238 Show the background while loading the menu
This is better than showing an empty black screen, I think.
2014-04-29 00:22:04 +02:00
Paul Cercueil
5fa8919f2b Allow to map actions to keyboard keys and joystick keys at the same time 2014-04-20 16:08:17 +02:00
Paul Cercueil
92a6453ff8 Re-insert proper detection of the %f tokens for OPK apps 2014-04-18 09:10:01 +02:00
Paul Cercueil
47b098cce6 Fix text in log viewer disappearing when pressing alt-right 2014-04-17 20:52:41 +02:00
Paul Cercueil
b1eedf6992 Init SDL timers before creating the menu 2014-04-14 00:28:11 +02:00
Paul Cercueil
9fba35feed Init the Menu before initializing SDL
This avoids seeing a black screen for a few seconds while GMenu2X
is loading.
2014-03-23 12:48:30 +01:00
Paul Cercueil
eae7156d4e Fix one icon of the GCW skin
One line had more alpha than the others.
2014-03-03 19:04:45 +01:00
Paul Cercueil
8a560e4845 Added GCW theme by Nebuleon 2014-03-02 17:53:54 +01:00
Paul Cercueil
fd2c4fd9ff Added ScanlinesBlue and ScanlinesRed themes
Those themes were fully created by hi-ban, kudos to him.
2014-03-02 15:31:56 +01:00
Paul Cercueil
b087e5c1f9 Fix key repeat of analog stick working only on some screens 2014-02-24 22:34:53 +01:00
Paul Cercueil
7777b9edde Added key repeat on analog sticks and hats 2014-02-23 17:00:12 +01:00
Paul Cercueil
c19e78951d Fix launching non-OPK apps with files with special characters 2014-02-23 16:55:14 +01:00
Paul Cercueil
b0846812b8 Show disk usage of the home partition, not the one mounted on /boot 2014-02-07 13:43:46 +01:00
Paul Cercueil
0fd8333257 Merge branch 'opkrun' 2014-02-05 16:29:07 +01:00
Paul Cercueil
55a6528cde Revert to launching in the shell for non-OPK apps 2014-02-05 16:26:00 +01:00
Paul Cercueil
a7f0fef059 linkapp.cpp: remove dead/useless code 2014-02-05 14:53:46 +01:00
Paul Cercueil
1a1f891a4d Fix launching OPKs with a file containing spaces 2014-02-05 14:33:45 +01:00
Paul Cercueil
1792e6329b Change sort order so that OPKs are listed after normal links 2014-01-19 23:10:42 +01:00
Paul Cercueil
8bb58f6270 Sort links once they have all been added to the menu 2014-01-19 23:07:54 +01:00
Paul Cercueil
1d532c9b44 Delete obsolete 320x240 skin "OD" 2014-01-16 16:39:15 +01:00
Paul Cercueil
261002d184 Delete obsolete 320x240 skin "2010-12-14" 2014-01-16 16:26:55 +01:00
Paul Cercueil
cb82d55350 Set default link size to 80x50 2014-01-16 16:23:26 +01:00
Paul Cercueil
ad30fae321 Remove "scan for applications and games" feature
It's been broken for a long time now.
2014-01-16 16:07:06 +01:00
Paul Cercueil
e63ad99ba9 Set row size to 20px minimum in file list if browsing directories 2014-01-16 16:02:29 +01:00