Can now receive code snippets from a phone!
Font adjustment tries (cheaply) to account for newlines
This commit is contained in:
parent
dd7efae6b1
commit
c0f7213110
|
@ -21,7 +21,10 @@
|
||||||
},
|
},
|
||||||
"projectType": "native",
|
"projectType": "native",
|
||||||
"uuid": "70ec170a-8e1b-11ea-bc55-0242ac130003",
|
"uuid": "70ec170a-8e1b-11ea-bc55-0242ac130003",
|
||||||
"messageKeys": {},
|
"messageKeys": {
|
||||||
|
"ScriptNum": 0,
|
||||||
|
"ScriptText": 1
|
||||||
|
},
|
||||||
"enableMultiJS": false,
|
"enableMultiJS": false,
|
||||||
"displayName": "PebbLisp",
|
"displayName": "PebbLisp",
|
||||||
"watchapp": {
|
"watchapp": {
|
||||||
|
@ -38,4 +41,4 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "PebbLisp"
|
"name": "PebbLisp"
|
||||||
}
|
}
|
||||||
|
|
25
src/calc.c
25
src/calc.c
|
@ -64,10 +64,15 @@ static const int smallestFont = 3;
|
||||||
static void adjustFont()
|
static void adjustFont()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(temptext[i++]) {}
|
int size = 0;
|
||||||
int f = i < 50 ? smallestFont - 3 :
|
while(temptext[i++]) {
|
||||||
i < 100 ? smallestFont - 2 :
|
if(temptext[i] == '\n')
|
||||||
i < 130 ? smallestFont - 1 :
|
size += 10;
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
int f = size < 50 ? smallestFont - 3 :
|
||||||
|
size < 100 ? smallestFont - 2 :
|
||||||
|
size < 130 ? smallestFont - 1 :
|
||||||
smallestFont;
|
smallestFont;
|
||||||
text_layer_set_font(s_input_text_layer,
|
text_layer_set_font(s_input_text_layer,
|
||||||
fonts_get_system_font(fonts[f]));
|
fonts_get_system_font(fonts[f]));
|
||||||
|
@ -321,6 +326,16 @@ Object add_window(Object obj1, Object obj2, struct Environment *env)
|
||||||
return numberObject(1);
|
return numberObject(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void inbox_received_callback(DictionaryIterator *iter, void *context) {
|
||||||
|
Tuple *script_tuple = dict_find(iter, MESSAGE_KEY_ScriptText);
|
||||||
|
if(script_tuple) {
|
||||||
|
char *script_text = script_tuple->value->cstring;
|
||||||
|
snprintf(temptext, sizeof(temptext), "%s", script_text);
|
||||||
|
snprintf(mytext, sizeof(mytext), "%s", script_text);
|
||||||
|
updateText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** General **/
|
/** General **/
|
||||||
|
|
||||||
static struct Environment pebbleEnv()
|
static struct Environment pebbleEnv()
|
||||||
|
@ -341,6 +356,8 @@ static void init(void)
|
||||||
.unload = menu_unload
|
.unload = menu_unload
|
||||||
});
|
});
|
||||||
window_stack_push(s_menu_window, true);
|
window_stack_push(s_menu_window, true);
|
||||||
|
app_message_open(inbox_size, outbox_size);
|
||||||
|
app_message_register_inbox_received(inbox_received_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit(void)
|
static void deinit(void)
|
||||||
|
|
|
@ -64,6 +64,9 @@ const char *func_tokens[] = {
|
||||||
"sq ", "cube ", "exp "
|
"sq ", "cube ", "exp "
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint32_t inbox_size = 1024;
|
||||||
|
const uint32_t outbox_size = 64;
|
||||||
|
|
||||||
bool using_func_tokens = false;
|
bool using_func_tokens = false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue