Skip to content

Commit

Permalink
A few updates for Gtk backend (#3718)
Browse files Browse the repository at this point in the history
* Update  face/text for field

Needed for tests/react-test2.red

* Update for red-0.6.4

* Some fixes

* It seems that there is no effect from now with these sizes
  • Loading branch information
rcqls authored and qtxie committed Jan 11, 2019
1 parent 6c55966 commit 8c1bad4
Show file tree
Hide file tree
Showing 11 changed files with 397 additions and 64 deletions.
2 changes: 1 addition & 1 deletion build/includes.r
Expand Up @@ -157,8 +157,8 @@ write %build/bin/sources.r set-cache [
%win32.reds
%COM.reds
%image-gdiplus.reds
%image-quartz.reds
%image-gdk.reds
%image-quartz.reds
%win32-ansi.reds
%win32-print.reds
]
Expand Down
19 changes: 19 additions & 0 deletions environment/console/CLI/console-view.red
@@ -0,0 +1,19 @@
Red [
Title: "Red console"
Author: ["Nenad Rakocevic" "Kaj de Vos"]
File: %console.red
Tabs: 4
Rights: "Copyright (C) 2012-2018 Red Foundation. All rights reserved."
Needs: 'View
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/BSL-License.txt
}
]

#include %input.red
#include %../help.red
#include %../engine.red

system/console/init "Red Console"
system/console/launch
2 changes: 1 addition & 1 deletion environment/natives.red
Expand Up @@ -403,7 +403,7 @@ difference: make native! [[
/case "Use case-sensitive comparison"
/skip "Treat the series as fixed size records"
size [integer!]
return: [block! hash! string! bitset! typeset!]
return: [block! hash! string! bitset! typeset! time!]
]
#get-definition NAT_DIFFERENCE
]
Expand Down
6 changes: 4 additions & 2 deletions modules/view/VID.red
Expand Up @@ -22,7 +22,7 @@ system/view/VID: context [
#switch config/OS [
Windows [#include %backends/windows/rules.red]
macOS [#include %backends/macOS/rules.red]
Linux []
Linux [#include %backends/gtk3/rules.red]
]
]

Expand All @@ -38,7 +38,9 @@ system/view/VID: context [
capitalize
Cancel-OK
]
Linux []
Linux [
Cancel-OK
]
]
user: []

Expand Down
1 change: 1 addition & 0 deletions modules/view/backends/gtk3/gui.reds
Expand Up @@ -182,6 +182,7 @@ get-child-from-xy: func [
]

get-text-size: func [
face [red-object!]
str [red-string!]
font [red-object!]
pair [red-pair!]
Expand Down
47 changes: 47 additions & 0 deletions modules/view/backends/gtk3/rules.red
@@ -0,0 +1,47 @@
Red [
Title: "VID macOS GUI post-processing rules"
Author: "Nenad Rakocevic"
File: %rules.red
Tabs: 4
Rights: "Copyright (C) 2017-2018 Red Foundation. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/dockimbel/Red/blob/master/BSL-License.txt
}
]

cancel-captions: ["cancel" "delete" "remove"]
ok-captions: ["ok" "save" "apply"]

Cancel-OK: function [
"Put OK buttons last"
root [object!]
][
foreach-face/with root [
pos-x: face/offset/x
face/offset/x: f/offset/x
f/offset/x: pos-x
][
either all [
face/type = 'button
find ok-captions face/text
][
last-but: none
pos-x: face/offset/x
pos-y: face/offset/y

foreach f face/parent/pane [
all [
f <> face
f/type = 'button
find cancel-captions f/text
5 > absolute f/offset/y - pos-y
pos-x < f/offset/x
pos-x: f/offset/x
last-but: f
]
]
last-but
][no]
]
]
32 changes: 15 additions & 17 deletions modules/view/backends/platform.red
Expand Up @@ -518,6 +518,7 @@ system/view/platform: context [
#switch OS [
Windows [#include %windows/gui.reds]
macOS [#include %macOS/gui.reds]
; GTK backend (is it in conflict with %GTK/gui.reds)
Linux [#include %gtk3/gui.reds]
#default [] ;-- Linux
]
Expand Down Expand Up @@ -572,8 +573,9 @@ system/view/platform: context [
pair: as red-pair! stack/arguments
pair/header: TYPE_PAIR

;GTK branch: gui/get-text-size face text hFont pair
#switch OS [
Linux [gui/get-text-size text font pair]
Linux [gui/get-text-size face text font pair]
#default [gui/get-text-size face text hFont pair]
]
]
Expand Down Expand Up @@ -649,6 +651,8 @@ system/view/platform: context [
#switch OS [
Windows [gui/PostQuitMessage 0]
macOS [gui/post-quit-msg]
; GTK Backend
;TODO Linux [gui/post-quit-message]
#default [0]
]
]
Expand Down Expand Up @@ -722,6 +726,7 @@ system/view/platform: context [
drop-down: [0x3 2x3 regular 0x3 2x3 small 0x3 1x3 mini 0x2 1x3]
drop-list: [0x3 2x3 regular 0x3 2x3 small 0x3 1x3 mini 0x2 1x3]
]
; GTK branch (similar to macOS from now)
Linux [
button: [2x2 2x3 regular 6x6 4x7 small 5x5 4x6 mini 1x1 0x1]
regular: [6x6 4x7]
Expand All @@ -732,7 +737,6 @@ system/view/platform: context [
drop-down: [0x3 2x3 regular 0x3 2x3 small 0x3 1x3 mini 0x2 1x3]
drop-list: [0x3 2x3 regular 0x3 2x3 small 0x3 1x3 mini 0x2 1x3]
]
#default []
]]
extend system/view/metrics/paddings [#switch config/OS [
Windows [
Expand All @@ -753,6 +757,7 @@ system/view/platform: context [
group-box: [0x8 4x18]
drop-list: [14x26 0x0 regular 14x26 0x0 small 11x22 0x0 mini 11x22 0x0]
]
; GTK backend (similar to macOS from now)
Linux [
button: [11x11 0x0 regular 14x14 0x0 small 11x11 0x0 mini 11x11 0x0]
check: [20x0 3x1]
Expand All @@ -762,7 +767,6 @@ system/view/platform: context [
group-box: [0x8 4x18]
drop-list: [14x26 0x0 regular 14x26 0x0 small 11x22 0x0 mini 11x22 0x0]
]
#default []
]]
#switch config/OS [
Windows [
Expand Down Expand Up @@ -790,18 +794,8 @@ system/view/platform: context [
progress: 21
]
]
Linux [
extend system/view/metrics/def-heights [
check: 29
radio: 29
text: 22
field: 29
drop-down: 33
drop-list: 33
progress: 29
]
Linux [
]
#default []
]

colors: system/view/metrics/colors
Expand All @@ -811,9 +805,13 @@ system/view/platform: context [
;colors/window ;-- set in gui/init from OS metrics
;colors/panel ;-- set in gui/init from OS metrics
]
macOS []
Linux []
#default []
macOS [

]
; GTK Backends
Linux [

]
]

append svs make face! [ ;-- default screen
Expand Down

0 comments on commit 8c1bad4

Please sign in to comment.