103 lines
2.0 KiB
C
103 lines
2.0 KiB
C
/*##############################################################################
|
|
* 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;
|
|
};
|
|
|
|
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 command_mode {
|
|
struct tart_cstring input_cstr;
|
|
|
|
char inputBuffer[255];
|
|
int inputBufferIdx;
|
|
char prompt[30];
|
|
};
|
|
|
|
struct bottom_bar {
|
|
struct tart_cstring bottomBar_cstr;
|
|
struct tart_cell backgroundCell;
|
|
struct tart_cell modeCell;
|
|
|
|
nomi_vec2 size;
|
|
};
|
|
|
|
|
|
struct insert_mode {
|
|
struct tart_cstring textDisplay;
|
|
struct tart_cell cell;
|
|
};
|
|
|
|
void Create_commandMode();
|
|
|
|
void CreateWindow() {
|
|
|
|
}
|
|
|
|
void InitCommandMode() {
|
|
}
|
|
void InitInsertMode();
|
|
void InitNormalMode();
|
|
void InitNomiMode();
|
|
|
|
|
|
void CommandMode(struct command_mode cmdm) {
|
|
}
|
|
void InsertMode();
|
|
void NormalMode();
|
|
void NomiMode();
|
|
|
|
void Update();
|
|
|
|
void UpdateBigin();
|
|
void UpdateEnd();
|
|
|
|
void OnQuit();
|
|
void OnStart();
|
|
|
|
void Draw();
|
|
|
|
#endif /* ifndef EDITOR_H */
|