Permalink
Browse files

some extra prettyness in lists

  • Loading branch information...
stg committed May 30, 2012
1 parent fd31241 commit ed9ade374c777fc1a5b598c157f3e3749b5e2158
Showing with 11 additions and 2 deletions.
  1. BIN bin-win/gui.exe
  2. +9 −1 gui/main.c
  3. +2 −1 gui/ui.c
View
Binary file not shown.
View
@@ -475,6 +475,7 @@ void add_port(char *p_name,char *p_device) {
int main( int argc, char *argv[] ) {
uint8_t n;
listitem_t *p_item;
+ char *p_text;
// initialize sdl
if(SDL_Init(SDL_INIT_VIDEO)) return 1;
@@ -531,6 +532,8 @@ int main( int argc, char *argv[] ) {
// build edit pattern view
vedit=ui_fsview();
+ //edit[EDIT_GRID]=ui_add(vedit,ui_grid(1,1,38,23));
+ edit[EDIT_OK]=ui_add(vedit,ui_button(18,26,"OK"));
// build start emulator view
vemu=ui_view(30,15,"SELECT COMMUNICATIONS PORT");
@@ -553,7 +556,12 @@ int main( int argc, char *argv[] ) {
for(n=0;n<255;n++) {
p_mach=machine_get(n);
if(p_mach==NULL)break;
- p_item=ui_list_add(mach[MACH_LIST],p_mach->code,strlen(p_mach->name)+1);
+ p_text=malloc(strlen(p_mach->code)+strlen(p_mach->name)+2);
+ strcpy(p_text,p_mach->code);
+ strcat(p_text," ");
+ strcat(p_text,p_mach->name);
+ p_item=ui_list_add(mach[MACH_LIST],p_text,strlen(p_mach->name)+1);
+ free(p_text);
strcpy(p_item->data,p_mach->name);
}
// TODO: remove
View
@@ -213,8 +213,9 @@ static void list_draw(uiobj_t *p_ui) {
p_item=ui_list_index2item(p_ui,p_list->top);
r_white(p_view->x+p_ui->x+1,p_view->y+p_ui->y+1,p_ui->w-2,p_ui->h-2);
for(y=0;(y<p_ui->h-2)&&p_item;y++) {
- if(strlen(p_item->text)>=p_ui->w-2) {
+ if(strlen(p_item->text)>p_ui->w-2) {
memcpy(p_text,p_item->text,p_ui->w-2);
+ p_text[p_ui->w-3]='ù';
} else {
strcpy(p_text,p_item->text);
}

0 comments on commit ed9ade3

Please sign in to comment.