-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (C) 2006-2018 Kouhei Sutou <[email protected]> | ||
# Copyright (C) 2006-2023 Sutou Kouhei <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -230,7 +230,12 @@ def init_canvas_widgets | |
def init_timer_area | ||
@timer_area = Gtk::DrawingArea.new | ||
@timer_area.signal_connect("draw") do |area, context| | ||
context.set_source_rgb(1, 0, 0) if rest_time and rest_time < 0 | ||
draw_background(area, context) | ||
if rest_time and rest_time < 0 | ||
context.set_source_rgb(1, 0, 0) | ||
else | ||
context.set_source_rgb(0, 0, 0) | ||
end | ||
draw_text_as_large_as_possible(area, | ||
context, | ||
timer_text, | ||
|
@@ -242,6 +247,8 @@ def init_timer_area | |
def init_note_area | ||
@note_area = Gtk::DrawingArea.new | ||
@note_area.signal_connect("draw") do |area, context| | ||
draw_background(area, context) | ||
context.set_source_rgb(0, 0, 0) | ||
draw_text_as_large_as_possible(area, context, note_text) | ||
Gdk::Event::PROPAGATE | ||
end | ||
|
@@ -253,6 +260,13 @@ def update | |
adjust_slide | ||
end | ||
|
||
def draw_background(area, context) | ||
context.save do | ||
context.set_source_rgb(1, 1, 1) | ||
context.paint | ||
end | ||
end | ||
|
||
def note_text | ||
note = @canvas.current_slide["note"] | ||
return note if note.nil? | ||
|