text_editor: make functions and variables static. slightly reduce plugin size.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27400 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a874f77e18
commit
8e68e223a4
1 changed files with 23 additions and 20 deletions
|
@ -32,17 +32,23 @@ static int last_action_line = 0;
|
||||||
static int last_char_index = 0;
|
static int last_char_index = 0;
|
||||||
static bool audio_buf = false;
|
static bool audio_buf = false;
|
||||||
|
|
||||||
|
static char temp_line[MAX_LINE_LEN];
|
||||||
|
static char copy_buffer[MAX_LINE_LEN];
|
||||||
|
static char filename[MAX_PATH];
|
||||||
|
static char eol[3];
|
||||||
|
static bool newfile;
|
||||||
|
|
||||||
#define ACTION_INSERT 0
|
#define ACTION_INSERT 0
|
||||||
#define ACTION_GET 1
|
#define ACTION_GET 1
|
||||||
#define ACTION_REMOVE 2
|
#define ACTION_REMOVE 2
|
||||||
#define ACTION_UPDATE 3
|
#define ACTION_UPDATE 3
|
||||||
#define ACTION_CONCAT 4
|
#define ACTION_CONCAT 4
|
||||||
|
|
||||||
char* _do_action(int action, char* str, int line);
|
static char* _do_action(int action, char* str, int line);
|
||||||
#ifndef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifndef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
#define do_action _do_action
|
#define do_action _do_action
|
||||||
#else
|
#else
|
||||||
char* do_action(int action, char* str, int line)
|
static char* do_action(int action, char* str, int line)
|
||||||
{
|
{
|
||||||
char *r;
|
char *r;
|
||||||
rb->cpu_boost(1);
|
rb->cpu_boost(1);
|
||||||
|
@ -52,7 +58,7 @@ char* do_action(int action, char* str, int line)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* _do_action(int action, char* str, int line)
|
static char* _do_action(int action, char* str, int line)
|
||||||
{
|
{
|
||||||
int len, lennew;
|
int len, lennew;
|
||||||
int i=0,c=0;
|
int i=0,c=0;
|
||||||
|
@ -127,10 +133,7 @@ static const char* list_get_name_cb(int selected_item, void* data,
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
char filename[MAX_PATH];
|
static void get_eol_string(char* fn)
|
||||||
char eol[3];
|
|
||||||
bool newfile;
|
|
||||||
void get_eol_string(char* fn)
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char t;
|
char t;
|
||||||
|
@ -163,7 +166,7 @@ void get_eol_string(char* fn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save_changes(int overwrite)
|
static bool save_changes(int overwrite)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int i;
|
int i;
|
||||||
|
@ -185,10 +188,6 @@ bool save_changes(int overwrite)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!overwrite)
|
|
||||||
/* current directory may have changed */
|
|
||||||
rb->reload_directory();
|
|
||||||
|
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(1);
|
rb->cpu_boost(1);
|
||||||
|
@ -201,11 +200,16 @@ bool save_changes(int overwrite)
|
||||||
rb->cpu_boost(0);
|
rb->cpu_boost(0);
|
||||||
#endif
|
#endif
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
|
|
||||||
|
if (newfile || !overwrite)
|
||||||
|
/* current directory may have changed */
|
||||||
|
rb->reload_directory();
|
||||||
|
|
||||||
newfile = false;
|
newfile = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_lists(struct gui_synclist *lists, int sel)
|
static void setup_lists(struct gui_synclist *lists, int sel)
|
||||||
{
|
{
|
||||||
rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL);
|
rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL);
|
||||||
rb->gui_synclist_set_icon_callback(lists,NULL);
|
rb->gui_synclist_set_icon_callback(lists,NULL);
|
||||||
|
@ -220,7 +224,7 @@ enum {
|
||||||
MENU_RET_NO_UPDATE,
|
MENU_RET_NO_UPDATE,
|
||||||
MENU_RET_UPDATE,
|
MENU_RET_UPDATE,
|
||||||
};
|
};
|
||||||
int do_item_menu(int cur_sel, char* copy_buffer)
|
static int do_item_menu(int cur_sel)
|
||||||
{
|
{
|
||||||
int ret = MENU_RET_NO_UPDATE;
|
int ret = MENU_RET_NO_UPDATE;
|
||||||
MENUITEM_STRINGLIST(menu, "Line Options", NULL,
|
MENUITEM_STRINGLIST(menu, "Line Options", NULL,
|
||||||
|
@ -289,7 +293,7 @@ int do_item_menu(int cur_sel, char* copy_buffer)
|
||||||
|| (c>='0' && c<= '9'))
|
|| (c>='0' && c<= '9'))
|
||||||
#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \
|
#define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \
|
||||||
(toupper(c)) - 'A' + 10)
|
(toupper(c)) - 'A' + 10)
|
||||||
int hex_to_rgb(const char* hex, int* color)
|
static int my_hex_to_rgb(const char* hex, int* color)
|
||||||
{ int ok = 1;
|
{ int ok = 1;
|
||||||
int i;
|
int i;
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
|
@ -319,14 +323,12 @@ int hex_to_rgb(const char* hex, int* color)
|
||||||
enum plugin_status plugin_start(const void* parameter)
|
enum plugin_status plugin_start(const void* parameter)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
static char temp_line[MAX_LINE_LEN];
|
|
||||||
|
|
||||||
struct gui_synclist lists;
|
struct gui_synclist lists;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
int button;
|
int button;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
int cur_sel=0;
|
int cur_sel=0;
|
||||||
static char copy_buffer[MAX_LINE_LEN];
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
bool edit_colors_file = false;
|
bool edit_colors_file = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -418,7 +420,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
"Extension", "Colour");
|
"Extension", "Colour");
|
||||||
rb->strcpy(extension, name);
|
rb->strcpy(extension, name);
|
||||||
if (value)
|
if (value)
|
||||||
hex_to_rgb(value, &color);
|
my_hex_to_rgb(value, &color);
|
||||||
else
|
else
|
||||||
color = 0;
|
color = 0;
|
||||||
|
|
||||||
|
@ -465,8 +467,9 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
changed = true;
|
changed = true;
|
||||||
break;
|
break;
|
||||||
case ACTION_STD_MENU:
|
case ACTION_STD_MENU:
|
||||||
{ /* do the item menu */
|
{
|
||||||
switch (do_item_menu(cur_sel, copy_buffer))
|
/* do the item menu */
|
||||||
|
switch (do_item_menu(cur_sel))
|
||||||
{
|
{
|
||||||
case MENU_RET_SAVE:
|
case MENU_RET_SAVE:
|
||||||
if(save_changes(1))
|
if(save_changes(1))
|
||||||
|
|
Loading…
Reference in a new issue