working on seperating main into editor fiels

This commit is contained in:
2025-11-07 18:29:07 -08:00
parent 99c46cec29
commit 3f9bd14056
4 changed files with 92 additions and 34 deletions

View File

@@ -1,32 +1,73 @@
/*##############################################################################
* file: editor.c
*
* editor handles everything in the editor space. That means that this will
* handle every thing form nomai and editing text with in the editor its self.
*
* The editor will handle all tart related things. so that nothing else has to
* be handled.
*
*
* Auther: PreacherDHM
* Date: 07/11/2025
*##############################################################################
* */
#ifndef EDITOR_H
#define EDITOR_H
#include <tart.h>
#include "editor.h"
#include "nomi.h"
#define EDITOR_EVENT_WINDOW_RESIZE 0x01
#define EDITOR_EVENT_WINDOW_CLOSE 0x02
#define EDITOR_EVENT_WINDOW_OPEN 0x04
#define EDITOR_EVENT_ON_UPDATE 0x08
#define EDITOR_EVENT_MISC_1 16
#define EDITOR_EVENT_MISC_2 32
#define EDITOR_EVENT_MISC_3 64
#define EDITOR_EVENT_MISC_4 128
struct editor_window {
struct tart_window window;
struct tart_buffer buf;
struct tart_vec2 size;
tart_byte bufId;
const char* windowTitle;
};
struct tart_window window;
typedef int(editor_event_func)(void* editor_event);
struct editor_event {
struct editor_window* window;
unsigned char eventType;
unsigned char eventValue;
void* data;
int dataSize;
editor_event_func* evnet_func;
};
struct commandMode {
struct tart_cstring prompt_cstr;
struct command_mode {
struct tart_cstring input_cstr;
char inputBuffer[255];
int inputBufferIdx;
char* input;
char prompt[30];
};
struct bottomBar {
struct tart_cstring mode_cstr;
struct tart_cstring file_cstr;
struct tart_cstring branch_cstr;
struct tart_cell bottomBar_cell;
struct bottom_bar {
struct tart_cstring bottomBar_cstr;
struct tart_cell backgroundCell;
struct tart_cell modeCell;
nomi_vec2 size;
};
struct InsertMode {
struct insert_mode {
struct tart_cstring textDisplay;
struct tart_cell cell;
};
void Create_commandMode();
@@ -42,13 +83,7 @@ void InitNormalMode();
void InitNomiMode();
void CommandMode(struct commandMode cmdm) {
tart_draw_cstring_position(tart_get_buffer(&window, 0),
cmdm.input_cstr,
(struct tart_vec2){16,10});
tart_draw_cstring_position(tart_get_buffer(&window, 0),
cmdm.prompt_cstr,
(struct tart_vec2){0,10});
void CommandMode(struct command_mode cmdm) {
}
void InsertMode();
void NormalMode();