mirror of
https://github.com/joel16/VitaShell.git
synced 2025-02-09 21:32:44 +00:00
texteditor: refactor + fixes
This commit is contained in:
parent
4ce165384d
commit
dd5df9e341
@ -226,10 +226,10 @@ void contextMenuCtrl(ContextMenu *ctx) {
|
||||
if (pressed_buttons & SCE_CTRL_ENTER || pressed_buttons & SCE_CTRL_RIGHT) {
|
||||
if (ctx_menu_mode == CONTEXT_MENU_OPENED) {
|
||||
if (ctx->menuEnterCallback)
|
||||
ctx_menu_mode = ctx->menuEnterCallback(ctx_menu_pos);
|
||||
ctx_menu_mode = ctx->menuEnterCallback(ctx_menu_pos, ctx->context);
|
||||
} else if (ctx_menu_mode == CONTEXT_MENU_MORE_OPENED) {
|
||||
if (ctx->menuMoreEnterCallback)
|
||||
ctx_menu_mode = ctx->menuMoreEnterCallback(ctx_menu_more_pos);
|
||||
ctx_menu_mode = ctx->menuMoreEnterCallback(ctx_menu_more_pos, ctx->context);
|
||||
}
|
||||
}
|
||||
}
|
@ -41,8 +41,9 @@ typedef struct {
|
||||
float menu_max_width;
|
||||
float menu_more_max_width;
|
||||
int more_pos;
|
||||
int (* menuEnterCallback)(int pos);
|
||||
int (* menuMoreEnterCallback)(int pos);
|
||||
int (* menuEnterCallback)(int pos, void* context);
|
||||
int (* menuMoreEnterCallback)(int pos, void* context);
|
||||
void *context;
|
||||
} ContextMenu;
|
||||
|
||||
enum ContextMenuModes {
|
||||
|
4
main.c
4
main.c
@ -581,7 +581,7 @@ void setContextMenuMoreVisibilities() {
|
||||
setContextMenuMorePos(-1);
|
||||
}
|
||||
|
||||
int contextMenuEnterCallback(int pos) {
|
||||
int contextMenuEnterCallback(int pos, void* context) {
|
||||
switch (pos) {
|
||||
case MENU_ENTRY_MARK_UNMARK_ALL:
|
||||
{
|
||||
@ -764,7 +764,7 @@ int contextMenuEnterCallback(int pos) {
|
||||
return CONTEXT_MENU_CLOSING;
|
||||
}
|
||||
|
||||
int contextMenuMoreEnterCallback(int pos) {
|
||||
int contextMenuMoreEnterCallback(int pos, void* context) {
|
||||
switch (pos) {
|
||||
case MENU_MORE_ENTRY_INSTALL_ALL:
|
||||
{
|
||||
|
11
text.h
11
text.h
@ -23,6 +23,8 @@
|
||||
#define MAX_LINE_CHARACTERS 1024
|
||||
#define MAX_COPY_BUFFER_SIZE 1024
|
||||
|
||||
#define MAX_SELECTION 1024
|
||||
|
||||
#define TEXT_START_X 97.0f
|
||||
|
||||
#define MAX_SEARCH_RESULTS 1024 * 1024
|
||||
@ -32,6 +34,7 @@ typedef struct TextListEntry {
|
||||
struct TextListEntry *next;
|
||||
struct TextListEntry *previous;
|
||||
int line_number;
|
||||
int selected;
|
||||
char line[MAX_LINE_CHARACTERS];
|
||||
} TextListEntry;
|
||||
|
||||
@ -47,14 +50,6 @@ typedef struct CopyEntry {
|
||||
|
||||
void initTextContextMenuWidth();
|
||||
|
||||
typedef struct SearchParams {
|
||||
char search_term[MAX_LINE_CHARACTERS];
|
||||
int *search_result_offsets;
|
||||
char *buffer;
|
||||
int size;
|
||||
|
||||
} SearchParams;
|
||||
|
||||
int textViewer(char *file);
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user