Skip to content

Commit

Permalink
make compile with V 0.1.27 4af4a8f
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed May 23, 2020
1 parent 6fed65a commit ad1b74e
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 243 deletions.
46 changes: 23 additions & 23 deletions config.v
Expand Up @@ -44,12 +44,12 @@ mut:
red_cfg gx.TextCfg
}

fn (config mut Config) init_colors() {
fn (mut config Config) init_colors() {
config.dark_mode = '-dark' in os.args
config.reload_config()
}

fn (config mut Config) reload_config() {
fn (mut config Config) reload_config() {
config.set_textsize()
config.set_tab()
config.set_vcolor()
Expand All @@ -70,40 +70,40 @@ fn (config mut Config) reload_config() {
config.set_red()
}

fn (config mut Config) set_textsize() {
fn (mut config Config) set_textsize() {
config.text_size = 18
}

fn (config mut Config) set_tab() {
fn (mut config Config) set_tab() {
config.tab_size = 4
config.tab = int(`\t`)
}

fn (config mut Config) set_vcolor() {
fn (mut config Config) set_vcolor() {
if !config.dark_mode {
config.vcolor = gx.Color{226, 233, 241}
} else {
config.vcolor = gx.Color{60, 60, 60}
}
}

fn (config mut Config) set_split() {
fn (mut config Config) set_split() {
if !config.dark_mode {
config.split_color = gx.Color{223, 223, 223}
} else {
config.split_color = gx.Color{50, 50, 50}
}
}

fn (config mut Config) set_bgcolor() {
fn (mut config Config) set_bgcolor() {
if !config.dark_mode {
config.bgcolor = gx.Color{245, 245, 245}
} else {
config.bgcolor = gx.Color{30, 30, 30}
}
}

fn (config mut Config) set_errorbgcolor() {
fn (mut config Config) set_errorbgcolor() {
if !config.dark_mode {
config.errorbgcolor = gx.Color{240, 0, 0}
} else {
Expand All @@ -112,7 +112,7 @@ fn (config mut Config) set_errorbgcolor() {
}


fn (config mut Config) set_string() {
fn (mut config Config) set_string() {
if !config.dark_mode {
config.string_color = gx.Color{179, 58, 44}
} else {
Expand All @@ -124,7 +124,7 @@ fn (config mut Config) set_string() {
}
}

fn (config mut Config) set_key() {
fn (mut config Config) set_key() {
if !config.dark_mode {
config.key_color = gx.Color{74, 103, 154}
} else {
Expand All @@ -136,23 +136,23 @@ fn (config mut Config) set_key() {
}
}

fn (config mut Config) set_title() {
fn (mut config Config) set_title() {
if !config.dark_mode {
config.title_color = gx.Color{40, 40, 40}
} else {
config.title_color = gx.Color{40, 40, 40}
}
}

fn (config mut Config) set_cursor() {
fn (mut config Config) set_cursor() {
if !config.dark_mode {
config.cursor_color = gx.black
} else {
config.cursor_color = gx.white
}
}

fn (config mut Config) set_txt() {
fn (mut config Config) set_txt() {
if !config.dark_mode {
config.text_color = gx.black
} else {
Expand All @@ -164,56 +164,56 @@ fn (config mut Config) set_txt() {
}
}

fn (config mut Config) set_comment() {
fn (mut config Config) set_comment() {
config.comment_color = gx.dark_gray
config.comment_cfg = gx.TextCfg {
size: config.text_size,
color: config.comment_color,
}
}

fn (config mut Config) set_filename() {
fn (mut config Config) set_filename() {
config.file_name_color = gx.white
config.file_name_cfg = gx.TextCfg {
size: config.text_size,
color: config.file_name_color,
}
}

fn (config mut Config) set_plus() {
fn (mut config Config) set_plus() {
config.plus_color = gx.green
config.plus_cfg = gx.TextCfg {
size: config.text_size,
color: config.plus_color,
}
}

fn (config mut Config) set_minus() {
fn (mut config Config) set_minus() {
config.minus_color = gx.green
config.minus_cfg = gx.TextCfg {
size: config.text_size,
color: config.minus_color,
}
}

fn (config mut Config) set_line_nr() {
fn (mut config Config) set_line_nr() {
config.line_nr_color = gx.dark_gray
config.line_nr_cfg = gx.TextCfg {
size: config.text_size
color: config.line_nr_color
align: gx.align_right
size: config.text_size,
color: config.line_nr_color,
align: gx.align_right,
}
}

fn (config mut Config) set_green() {
fn (mut config Config) set_green() {
config.green_color = gx.green
config.green_cfg = gx.TextCfg {
size: config.text_size,
color: config.green_color,
}
}

fn (config mut Config) set_red() {
fn (mut config Config) set_red() {
config.red_color = gx.red
config.red_cfg = gx.TextCfg {
size: config.text_size,
Expand Down
8 changes: 4 additions & 4 deletions timer.v
Expand Up @@ -41,7 +41,7 @@ struct Task {
}


fn (t mut Timer) load_tasks() {
fn (mut t Timer) load_tasks() {
//println('timer.load_tasks()')
lines := os.read_lines(tasks_path) or { return }
//println(lines)
Expand Down Expand Up @@ -120,10 +120,10 @@ const (
//scale = 3
)

//fn (t mut Timer) load_tasks() {
//fn (mut t Timer) load_tasks() {
//}

fn (t mut Timer) draw() {
fn (mut t Timer) draw() {
window_width := t.gg.width/2
window_height := t.gg.height-20
window_x := (t.gg.width - window_width) / 2
Expand Down Expand Up @@ -171,7 +171,7 @@ fn (t mut Timer) draw() {

}

fn (timer mut Timer) key_down(key int, super bool) {
fn (mut timer Timer) key_down(key int, super bool) {
match key {
C.GLFW_KEY_UP {
timer.date = timer.date.add_days(-1)
Expand Down
32 changes: 32 additions & 0 deletions uiold/ui_darwin.c.v
@@ -0,0 +1,32 @@
module uiold

#flag -framework Carbon
#flag -framework Cocoa

#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>

__global default_font &C.NSFont


fn focus_app(next, event, data voidptr) {
#NSLog(@"2The hot key was pressed.");
#NSApplication *myApp = [NSApplication sharedApplication];
#[myApp activateIgnoringOtherApps:YES];
//return noErr;
}

pub fn reg_key_vid() {
println('REGISTERING VID KEY')
#EventHotKeyRef gMyHotKeyRef;

#EventHotKeyID gMyHotKeyID;
#EventTypeSpec eventType;
#eventType.eventClass = kEventClassKeyboard;
#eventType.eventKind = kEventHotKeyPressed;
#InstallApplicationEventHandler(&uiold__focus_app, 1, &eventType, NULL, NULL);
#gMyHotKeyID.signature = 'rml1';
#gMyHotKeyID.id = 1;
#RegisterEventHotKey(kVK_ANSI_1, cmdKey, gMyHotKeyID,
#GetApplicationEventTarget(), 0, &gMyHotKeyRef);
}
9 changes: 9 additions & 0 deletions uiold/ui_linux.c.v
@@ -0,0 +1,9 @@
module uiold

fn focus_app(next, event, data voidptr) {
}

pub fn reg_key_vid() {
}


9 changes: 9 additions & 0 deletions uiold/ui_windows.c.v
@@ -0,0 +1,9 @@
module uiold

fn focus_app(next, event, data voidptr) {
}

pub fn reg_key_vid() {
}


0 comments on commit ad1b74e

Please sign in to comment.