eliminated all view types except File_View
This commit is contained in:
parent
f8bc11f543
commit
6575a1cccd
|
@ -72,11 +72,10 @@ CUSTOM_COMMAND_SIG(write_decrement){
|
|||
app->buffer_replace_range(app, &buffer, buffer.buffer_cursor_pos, buffer.buffer_cursor_pos, text, size);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_long_braces){
|
||||
static void
|
||||
long_braces(Application_Links *app, char *text, int size){
|
||||
File_View_Summary view;
|
||||
Buffer_Summary buffer;
|
||||
char text[] = "{\n\n}";
|
||||
int size = sizeof(text) - 1;
|
||||
int pos;
|
||||
|
||||
view = app->get_active_file_view(app);
|
||||
|
@ -92,24 +91,22 @@ CUSTOM_COMMAND_SIG(open_long_braces){
|
|||
exec_command(app, cmdid_auto_tab_range);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_long_braces){
|
||||
char text[] = "{\n\n}";
|
||||
int size = sizeof(text) - 1;
|
||||
long_braces(app, text, size);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_long_braces_semicolon){
|
||||
File_View_Summary view;
|
||||
Buffer_Summary buffer;
|
||||
char text[] = "{\n\n};";
|
||||
int size = sizeof(text) - 1;
|
||||
int pos;
|
||||
|
||||
view = app->get_active_file_view(app);
|
||||
buffer = app->get_buffer(app, view.buffer_id);
|
||||
|
||||
pos = view.cursor.pos;
|
||||
app->buffer_replace_range(app, &buffer, pos, pos, text, size);
|
||||
app->view_set_cursor(app, &view, seek_pos(pos + 2), 1);
|
||||
|
||||
push_parameter(app, par_range_start, pos);
|
||||
push_parameter(app, par_range_end, pos + size);
|
||||
push_parameter(app, par_clear_blank_lines, 0);
|
||||
exec_command(app, cmdid_auto_tab_range);
|
||||
long_braces(app, text, size);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_long_braces_break){
|
||||
char text[] = "{\n\n}break;";
|
||||
int size = sizeof(text) - 1;
|
||||
long_braces(app, text, size);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(paren_wrap){
|
||||
|
@ -768,7 +765,8 @@ extern "C" GET_BINDING_DATA(get_bindings){
|
|||
bind(context, '=', MDFR_CTRL, write_increment);
|
||||
bind(context, '-', MDFR_CTRL, write_decrement);
|
||||
bind(context, '[', MDFR_CTRL, open_long_braces);
|
||||
bind(context, '{', MDFR_CTRL, open_long_braces);
|
||||
bind(context, '{', MDFR_CTRL, open_long_braces_semicolon);
|
||||
bind(context, '}', MDFR_CTRL, open_long_braces_break);
|
||||
bind(context, '9', MDFR_CTRL, paren_wrap);
|
||||
bind(context, 'i', MDFR_ALT, if0_off);
|
||||
|
||||
|
|
9
4ed.h
9
4ed.h
|
@ -115,19 +115,10 @@ struct Application_Step_Result{
|
|||
|
||||
typedef App_Step_Sig(App_Step);
|
||||
|
||||
#define App_Alloc_Sig(name) void *name(void *handle, i32 size)
|
||||
typedef App_Alloc_Sig(App_Alloc);
|
||||
|
||||
#define App_Free_Sig(name) void name(void *handle, void *block)
|
||||
typedef App_Free_Sig(App_Free);
|
||||
|
||||
struct App_Functions{
|
||||
App_Read_Command_Line *read_command_line;
|
||||
App_Init *init;
|
||||
App_Step *step;
|
||||
|
||||
App_Alloc *alloc;
|
||||
App_Free *free;
|
||||
};
|
||||
|
||||
#define App_Get_Functions_Sig(name) App_Functions name()
|
||||
|
|
|
@ -9,16 +9,7 @@
|
|||
|
||||
// TOP
|
||||
|
||||
#define VERSION_NUMBER "alpha 3.4.4"
|
||||
|
||||
#ifdef FRED_SUPER
|
||||
#define VERSION_TYPE " super!"
|
||||
#else
|
||||
#define VERSION_TYPE ""
|
||||
#endif
|
||||
|
||||
#define VERSION VERSION_NUMBER VERSION_TYPE
|
||||
|
||||
#include "4ed_version.h"
|
||||
#include "4ed_config.h"
|
||||
|
||||
#define BUFFER_EXPERIMENT_SCALPEL 0
|
||||
|
@ -53,12 +44,8 @@
|
|||
#include "4ed_file.cpp"
|
||||
#include "4ed_gui.cpp"
|
||||
#include "4ed_delay.cpp"
|
||||
#include "4ed_file_view.cpp"
|
||||
#include "4ed_color_view.cpp"
|
||||
#include "4ed_interactive_view.cpp"
|
||||
#include "4ed_menu_view.cpp"
|
||||
#include "4ed_app_settings.h"
|
||||
#include "4ed_config_view.cpp"
|
||||
#include "4ed_file_view.cpp"
|
||||
#include "4ed.cpp"
|
||||
|
||||
// BOTTOM
|
||||
|
|
1909
4ed_color_view.cpp
1909
4ed_color_view.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 27.01.2016
|
||||
*
|
||||
* Configuration customizing view for 4coder
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
struct Config_View{
|
||||
View view_base;
|
||||
UI_State state;
|
||||
Style *style;
|
||||
Font_Set *font_set;
|
||||
Working_Set *working_set;
|
||||
|
||||
App_Settings *settings;
|
||||
};
|
||||
|
||||
inline Config_View*
|
||||
view_to_config_view(View *view){
|
||||
Config_View *result = 0;
|
||||
if (view->type == VIEW_TYPE_CONFIG){
|
||||
result = (Config_View*)view;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal i32
|
||||
step_draw_config_view(Config_View *view, Render_Target *target, i32_Rect rect,
|
||||
Input_Summary *user_input, b32 input_stage){
|
||||
i32 result = 0;
|
||||
|
||||
UI_State state =
|
||||
ui_state_init(&view->state, target, user_input,
|
||||
view->style, view->font_set, view->working_set, input_stage);
|
||||
|
||||
UI_Layout layout;
|
||||
begin_layout(&layout, rect);
|
||||
|
||||
i32 id = 0;
|
||||
|
||||
do_label(&state, &layout, literal("Config"), 2.f);
|
||||
|
||||
if (do_checkbox_list_option(++id, &state, &layout, make_lit_string("Left Ctrl + Left Alt = AltGr"),
|
||||
view->settings->lctrl_lalt_is_altgr)){
|
||||
view->settings->lctrl_lalt_is_altgr = !view->settings->lctrl_lalt_is_altgr;
|
||||
}
|
||||
|
||||
if (ui_finish_frame(&view->state, &state, &layout, rect, 0, 0)){
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Do_View_Sig(do_config_view){
|
||||
i32 result = 0;
|
||||
|
||||
Config_View *config_view = (Config_View*)view;
|
||||
switch (message){
|
||||
case VMSG_STEP: case VMSG_DRAW:
|
||||
result = step_draw_config_view(config_view, target, rect, user_input,
|
||||
(message == VMSG_STEP));
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal Config_View*
|
||||
config_view_init(View *view, Style *style, Working_Set *working_set,
|
||||
Font_Set *font_set, App_Settings *settings){
|
||||
view->type = VIEW_TYPE_CONFIG;
|
||||
view->do_view = do_config_view;
|
||||
|
||||
Config_View *result;
|
||||
result = (Config_View*)view;
|
||||
result->style = style;
|
||||
result->working_set = working_set;
|
||||
result->font_set = font_set;
|
||||
result->settings = settings;
|
||||
return result;
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
@ -8,9 +8,6 @@ enum Action_Type{
|
|||
DACT_SWITCH,
|
||||
DACT_TRY_KILL,
|
||||
DACT_KILL,
|
||||
DACT_CLOSE_MINOR,
|
||||
DACT_THEME_OPTIONS,
|
||||
DACT_KEYBOARD_OPTIONS,
|
||||
};
|
||||
|
||||
struct Delayed_Action{
|
||||
|
@ -113,6 +110,3 @@ delayed_action_repush(Delay *delay, Delayed_Action *act){
|
|||
#define delayed_switch(delay, ...) delayed_action_(delay, DACT_SWITCH, __VA_ARGS__)
|
||||
#define delayed_try_kill(delay, ...) delayed_action_(delay, DACT_TRY_KILL, __VA_ARGS__)
|
||||
#define delayed_kill(delay, ...) delayed_action_(delay, DACT_KILL, __VA_ARGS__)
|
||||
#define delayed_close_minor(delay, ...) delayed_action_(delay, DACT_CLOSE_MINOR, __VA_ARGS__)
|
||||
#define delayed_theme_options(delay, ...) delayed_action_(delay, DACT_THEME_OPTIONS, __VA_ARGS__)
|
||||
#define delayed_keyboard_options(delay, ...) delayed_action_(delay, DACT_KEYBOARD_OPTIONS, __VA_ARGS__)
|
||||
|
|
62
4ed_file.cpp
62
4ed_file.cpp
|
@ -254,16 +254,6 @@ struct Hot_Directory{
|
|||
char slash;
|
||||
};
|
||||
|
||||
internal void
|
||||
hot_directory_init(Hot_Directory *hot_directory, String base, String dir, char slash){
|
||||
hot_directory->string = base;
|
||||
hot_directory->string.str[255] = 0;
|
||||
hot_directory->string.size = 0;
|
||||
copy(&hot_directory->string, dir);
|
||||
append(&hot_directory->string, slash);
|
||||
hot_directory->slash = slash;
|
||||
}
|
||||
|
||||
internal void
|
||||
hot_directory_clean_end(Hot_Directory *hot_directory){
|
||||
String *str = &hot_directory->string;
|
||||
|
@ -326,6 +316,16 @@ hot_directory_reload(System_Functions *system, Hot_Directory *hot_directory, Wor
|
|||
hot_directory_fixup(hot_directory, working_set);
|
||||
}
|
||||
|
||||
internal void
|
||||
hot_directory_init(Hot_Directory *hot_directory, String base, String dir, char slash){
|
||||
hot_directory->string = base;
|
||||
hot_directory->string.str[255] = 0;
|
||||
hot_directory->string.size = 0;
|
||||
copy(&hot_directory->string, dir);
|
||||
append(&hot_directory->string, slash);
|
||||
hot_directory->slash = slash;
|
||||
}
|
||||
|
||||
struct Hot_Directory_Match{
|
||||
String filename;
|
||||
b32 is_folder;
|
||||
|
@ -404,5 +404,47 @@ buffer_needs_save(Editing_File *file){
|
|||
return(result);
|
||||
}
|
||||
|
||||
inline b32
|
||||
file_is_ready(Editing_File *file){
|
||||
b32 result = 0;
|
||||
if (file && file->state.is_loading == 0){
|
||||
result = 1;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
inline Editing_File*
|
||||
working_set_contains(Working_Set *working, String filename){
|
||||
Editing_File *result = 0;
|
||||
i32 id;
|
||||
if (table_find(&working->table, filename, &id)){
|
||||
if (id < working->file_max_count){
|
||||
result = working->files + id;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO(allen): Find a way to choose an ordering for these so it picks better first options.
|
||||
internal Editing_File*
|
||||
working_set_lookup_file(Working_Set *working_set, String string){
|
||||
Editing_File *file = working_set_contains(working_set, string);
|
||||
|
||||
if (!file){
|
||||
i32 file_i;
|
||||
i32 end = working_set->file_index_count;
|
||||
file = working_set->files;
|
||||
for (file_i = 0; file_i < end; ++file_i, ++file){
|
||||
if (file->name.live_name.str &&
|
||||
(string.size == 0 || has_substr(file->name.live_name, string))){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (file_i == end) file = 0;
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
1322
4ed_gui.cpp
1322
4ed_gui.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,233 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 19.09.2015
|
||||
*
|
||||
* File editing view for 4coder
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
enum Interactive_View_Action{
|
||||
INTV_OPEN,
|
||||
INTV_SAVE_AS,
|
||||
INTV_NEW,
|
||||
INTV_SWITCH,
|
||||
INTV_KILL,
|
||||
INTV_SURE_TO_KILL
|
||||
};
|
||||
|
||||
enum Interactive_View_Interaction{
|
||||
INTV_SYS_FILE_LIST,
|
||||
INTV_LIVE_FILE_LIST,
|
||||
INTV_SURE_TO_KILL_INTER
|
||||
};
|
||||
|
||||
struct Interactive_View{
|
||||
View view_base;
|
||||
Hot_Directory *hot_directory;
|
||||
Style *style;
|
||||
Working_Set *working_set;
|
||||
Delay *delay;
|
||||
Font_Set *font_set;
|
||||
UI_State state;
|
||||
Interactive_View_Interaction interaction;
|
||||
Interactive_View_Action action;
|
||||
int finished;
|
||||
|
||||
char query_[256];
|
||||
String query;
|
||||
char dest_[256];
|
||||
String dest;
|
||||
i32 user_action;
|
||||
};
|
||||
|
||||
inline Interactive_View*
|
||||
view_to_interactive_view(View *view){
|
||||
Interactive_View *result = 0;
|
||||
if (view->type == VIEW_TYPE_INTERACTIVE)
|
||||
result = (Interactive_View*)view;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
interactive_view_complete(Interactive_View *view){
|
||||
Panel *panel = view->view_base.panel;
|
||||
switch (view->action){
|
||||
case INTV_OPEN:
|
||||
delayed_open(view->delay, view->hot_directory->string, panel);
|
||||
break;
|
||||
|
||||
case INTV_SAVE_AS:
|
||||
delayed_save_as(view->delay, view->hot_directory->string, panel);
|
||||
delayed_close_minor(view->delay, panel);
|
||||
break;
|
||||
|
||||
case INTV_NEW:
|
||||
delayed_new(view->delay, view->hot_directory->string, panel);
|
||||
break;
|
||||
|
||||
case INTV_SWITCH:
|
||||
delayed_switch(view->delay, view->dest, panel);
|
||||
break;
|
||||
|
||||
case INTV_KILL:
|
||||
delayed_try_kill(view->delay, view->dest, panel);
|
||||
break;
|
||||
|
||||
case INTV_SURE_TO_KILL:
|
||||
switch (view->user_action){
|
||||
case 0:
|
||||
delayed_kill(view->delay, view->dest, panel);
|
||||
delayed_close_minor(view->delay, {}, panel);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
delayed_close_minor(view->delay, {}, panel);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
delayed_save(view->delay, view->dest, panel);
|
||||
delayed_kill(view->delay, view->dest, panel);
|
||||
delayed_close_minor(view->delay, {}, panel);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
internal i32
|
||||
step_draw_int_view(System_Functions *system, Interactive_View *view,
|
||||
Render_Target *target, i32_Rect rect,
|
||||
Input_Summary *user_input, b32 input_stage){
|
||||
if (view->finished) return 0;
|
||||
i32 result = 0;
|
||||
|
||||
UI_State state =
|
||||
ui_state_init(&view->state, target, user_input,
|
||||
view->style, view->font_set, view->working_set, input_stage);
|
||||
|
||||
UI_Layout layout;
|
||||
begin_layout(&layout, rect);
|
||||
|
||||
b32 new_dir = 0;
|
||||
b32 complete = 0;
|
||||
|
||||
do_label(&state, &layout, view->query, 1.f);
|
||||
|
||||
b32 case_sensitive = 0;
|
||||
|
||||
switch (view->interaction){
|
||||
case INTV_SYS_FILE_LIST:
|
||||
{
|
||||
b32 is_new = (view->action == INTV_NEW);
|
||||
|
||||
if (do_file_list_box(system, &state,
|
||||
&layout, view->hot_directory, 0, !is_new, case_sensitive,
|
||||
&new_dir, &complete, 0)){
|
||||
result = 1;
|
||||
}
|
||||
if (new_dir){
|
||||
hot_directory_reload(system,
|
||||
view->hot_directory, view->working_set);
|
||||
}
|
||||
}break;
|
||||
|
||||
case INTV_LIVE_FILE_LIST:
|
||||
if (do_live_file_list_box(system, &state, &layout, view->working_set, &view->dest, &complete)){
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case INTV_SURE_TO_KILL_INTER:
|
||||
{
|
||||
i32 action = -1;
|
||||
char s_[256];
|
||||
String s = make_fixed_width_string(s_);
|
||||
append(&s, view->dest);
|
||||
append(&s, " has unsaved changes, kill it?");
|
||||
do_label(&state, &layout, s, 1.f);
|
||||
|
||||
i32 id = 0;
|
||||
if (do_list_option(++id, &state, &layout, make_lit_string("(Y)es"))){
|
||||
action = 0;
|
||||
}
|
||||
|
||||
if (do_list_option(++id, &state, &layout, make_lit_string("(N)o"))){
|
||||
action = 1;
|
||||
}
|
||||
|
||||
if (do_list_option(++id, &state, &layout, make_lit_string("(S)ave and kill"))){
|
||||
action = 2;
|
||||
}
|
||||
|
||||
if (action == -1 && input_stage){
|
||||
i32 key_count = user_input->keys.count;
|
||||
for (i32 i = 0; i < key_count; ++i){
|
||||
Key_Event_Data key = user_input->keys.keys[i];
|
||||
switch (key.character){
|
||||
case 'y': case 'Y': action = 0; break;
|
||||
case 'n': case 'N': action = 1; break;
|
||||
case 's': case 'S': action = 2; break;
|
||||
}
|
||||
if (action == -1 && key.keycode == key_esc) action = 1;
|
||||
if (action != -1) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action != -1){
|
||||
complete = 1;
|
||||
view->user_action = action;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
||||
if (complete){
|
||||
view->finished = 1;
|
||||
interactive_view_complete(view);
|
||||
}
|
||||
|
||||
if (ui_finish_frame(&view->state, &state, &layout, rect, 0, 0)){
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Do_View_Sig(do_interactive_view){
|
||||
i32 result = 0;
|
||||
|
||||
view->mouse_cursor_type = APP_MOUSE_CURSOR_ARROW;
|
||||
Interactive_View *int_view = (Interactive_View*)view;
|
||||
switch (message){
|
||||
case VMSG_STEP: case VMSG_DRAW:
|
||||
result = step_draw_int_view(system, int_view, target, rect, user_input, (message == VMSG_STEP));
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal Interactive_View*
|
||||
interactive_view_init(System_Functions *system, View *view,
|
||||
Hot_Directory *hot_dir, Style *style,
|
||||
Working_Set *working_set, Font_Set *font_set, Delay *delay){
|
||||
Interactive_View *result = (Interactive_View*)view;
|
||||
view->type = VIEW_TYPE_INTERACTIVE;
|
||||
view->do_view = do_interactive_view;
|
||||
result->hot_directory = hot_dir;
|
||||
hot_directory_clean_end(hot_dir);
|
||||
hot_directory_reload(system, hot_dir, working_set);
|
||||
result->query = make_fixed_width_string(result->query_);
|
||||
result->dest = make_fixed_width_string(result->dest_);
|
||||
result->style = style;
|
||||
result->working_set = working_set;
|
||||
result->font_set = font_set;
|
||||
result->delay = delay;
|
||||
result->finished = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
@ -42,32 +42,13 @@ struct View;
|
|||
|
||||
typedef Do_View_Sig(Do_View_Function);
|
||||
|
||||
// TODO(allen): this shouldn't exist
|
||||
enum View_Type{
|
||||
VIEW_TYPE_NONE,
|
||||
VIEW_TYPE_FILE,
|
||||
VIEW_TYPE_COLOR,
|
||||
VIEW_TYPE_INTERACTIVE,
|
||||
VIEW_TYPE_MENU,
|
||||
VIEW_TYPE_CONFIG
|
||||
};
|
||||
|
||||
struct Panel;
|
||||
struct View{
|
||||
union{
|
||||
View *next_free;
|
||||
View *major;
|
||||
View *minor;
|
||||
};
|
||||
View *next_free;
|
||||
Panel *panel;
|
||||
Command_Map *map;
|
||||
Do_View_Function *do_view;
|
||||
Mem_Options *mem;
|
||||
i32 type;
|
||||
i32 block_size;
|
||||
Application_Mouse_Cursor mouse_cursor_type;
|
||||
b32 is_active;
|
||||
b32 is_minor;
|
||||
};
|
||||
|
||||
struct Live_Views{
|
||||
|
@ -168,8 +149,6 @@ live_set_alloc_view(Live_Views *live_set, Mem_Options *mem){
|
|||
live_set->free_view = result->next_free;
|
||||
memset(result, 0, live_set->stride);
|
||||
++live_set->count;
|
||||
result->is_active = 1;
|
||||
result->mem = mem;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -180,13 +159,11 @@ live_set_free_view(System_Functions *system, Exchange *exchange, Live_Views *liv
|
|||
view->next_free = live_set->free_view;
|
||||
live_set->free_view = view;
|
||||
--live_set->count;
|
||||
view->is_active = 0;
|
||||
}
|
||||
|
||||
inline void
|
||||
view_set_first(View *new_view, Panel *panel){
|
||||
new_view->panel = panel;
|
||||
new_view->minor = 0;
|
||||
panel->view = new_view;
|
||||
}
|
||||
|
||||
|
@ -194,47 +171,11 @@ inline void
|
|||
view_replace_major(System_Functions *system, Exchange *exchange,
|
||||
View *new_view, Panel *panel, Live_Views *live_set){
|
||||
View *view = panel->view;
|
||||
if (view->is_minor && view->major){
|
||||
live_set_free_view(system, exchange, live_set, view->major);
|
||||
}
|
||||
live_set_free_view(system, exchange, live_set, view);
|
||||
new_view->panel = panel;
|
||||
new_view->minor = 0;
|
||||
panel->view = new_view;
|
||||
}
|
||||
|
||||
inline void
|
||||
view_replace_minor(System_Functions *system, Exchange *exchange,
|
||||
View *new_view, Panel *panel, Live_Views *live_set){
|
||||
View *view = panel->view;
|
||||
|
||||
new_view->is_minor = 1;
|
||||
if (view->is_minor){
|
||||
new_view->major = view->major;
|
||||
live_set_free_view(system, exchange, live_set, view);
|
||||
}
|
||||
else{
|
||||
new_view->major = view;
|
||||
view->is_active = 0;
|
||||
}
|
||||
new_view->panel = panel;
|
||||
panel->view = new_view;
|
||||
}
|
||||
|
||||
inline void
|
||||
view_remove_minor(System_Functions *system, Exchange *exchange,
|
||||
Panel *panel, Live_Views *live_set){
|
||||
View *view = panel->view;
|
||||
View *major = view;
|
||||
if (view->is_minor){
|
||||
major = view->major;
|
||||
live_set_free_view(system, exchange, live_set, view);
|
||||
}
|
||||
Assert(major);
|
||||
panel->view = major;
|
||||
major->is_active = 1;
|
||||
}
|
||||
|
||||
struct Divider_And_ID{
|
||||
Panel_Divider* divider;
|
||||
i32 id;
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 26.09.2015
|
||||
*
|
||||
* File editing view for 4coder
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
struct Menu_View{
|
||||
View view_base;
|
||||
Style *style;
|
||||
Working_Set *working_set;
|
||||
Delay *delay;
|
||||
Font_Set *font_set;
|
||||
UI_State state;
|
||||
};
|
||||
|
||||
inline Menu_View*
|
||||
view_to_menu_view(View *view){
|
||||
Menu_View *result = 0;
|
||||
if (view->type == VIEW_TYPE_MENU){
|
||||
result = (Menu_View*)view;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal i32
|
||||
step_draw_menu_view(Menu_View *view, Render_Target *target, i32_Rect rect,
|
||||
Input_Summary *user_input, b32 input_stage){
|
||||
i32 result = 0;
|
||||
|
||||
UI_State state =
|
||||
ui_state_init(&view->state, target, user_input,
|
||||
view->style, view->font_set, view->working_set, input_stage);
|
||||
|
||||
UI_Layout layout;
|
||||
begin_layout(&layout, rect);
|
||||
|
||||
i32 id = 0;
|
||||
|
||||
do_label(&state, &layout, literal("Menu"), 2.f);
|
||||
|
||||
if (do_list_option(++id, &state, &layout, make_lit_string("Theme Options"))){
|
||||
delayed_theme_options(view->delay, {}, view->view_base.panel);
|
||||
}
|
||||
|
||||
if (do_list_option(++id, &state, &layout, make_lit_string("Keyboard Layout Options"))){
|
||||
delayed_keyboard_options(view->delay, {}, view->view_base.panel);
|
||||
}
|
||||
|
||||
if (ui_finish_frame(&view->state, &state, &layout, rect, 0, 0)){
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Do_View_Sig(do_menu_view){
|
||||
i32 result = 0;
|
||||
|
||||
Menu_View *menu_view = (Menu_View*)view;
|
||||
switch (message){
|
||||
case VMSG_STEP: case VMSG_DRAW:
|
||||
result = step_draw_menu_view(menu_view, target, rect, user_input, (message == VMSG_STEP));
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal Menu_View*
|
||||
menu_view_init(View *view, Style *style, Working_Set *working_set,
|
||||
Delay *delay, Font_Set *font_set){
|
||||
view->type = VIEW_TYPE_INTERACTIVE;
|
||||
view->do_view = do_menu_view;
|
||||
|
||||
Menu_View *result;
|
||||
result = (Menu_View*)view;
|
||||
result->style = style;
|
||||
result->working_set = working_set;
|
||||
result->delay = delay;
|
||||
result->font_set = font_set;
|
||||
return result;
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
||||
|
|
@ -108,7 +108,6 @@ char* generate_keycode_enum(){
|
|||
return(filename);
|
||||
}
|
||||
|
||||
|
||||
char daction_enum_name[] = "Action_Type";
|
||||
char *daction_enum[] = {
|
||||
"OPEN",
|
||||
|
@ -120,9 +119,6 @@ char *daction_enum[] = {
|
|||
"SWITCH",
|
||||
"TRY_KILL",
|
||||
"KILL",
|
||||
"CLOSE_MINOR",
|
||||
"THEME_OPTIONS",
|
||||
"KEYBOARD_OPTIONS"
|
||||
};
|
||||
|
||||
char str_alloc_copy[] =
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 01.03.2016
|
||||
*
|
||||
* Shared header for version stuff
|
||||
*
|
||||
*/
|
||||
|
||||
#define VERSION_NUMBER "alpha 3.4.4"
|
||||
|
||||
#ifdef FRED_SUPER
|
||||
#define VERSION_TYPE " super!"
|
||||
#else
|
||||
#define VERSION_TYPE ""
|
||||
#endif
|
||||
|
||||
#define VERSION VERSION_NUMBER VERSION_TYPE
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
// TOP
|
||||
|
||||
#include "4ed_version.h"
|
||||
#include "4ed_config.h"
|
||||
|
||||
#include "4ed_meta.h"
|
||||
|
@ -1827,7 +1828,7 @@ main(int argc, char **argv){
|
|||
// TODO(allen): non-fatal diagnostics
|
||||
}
|
||||
|
||||
#define WINDOW_NAME "4coder-window"
|
||||
#define WINDOW_NAME "4coder-window: " VERSION
|
||||
|
||||
i32 window_x;
|
||||
i32 window_y;
|
||||
|
|
Loading…
Reference in New Issue