|
@@ -23,26 +23,7 @@ void hex_viewer_scene_scene_1_on_enter(void* context) {
|
|
|
HEX_VIEWER_PERCENT_INPUT,
|
|
HEX_VIEWER_PERCENT_INPUT,
|
|
|
false);
|
|
false);
|
|
|
|
|
|
|
|
- // ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
|
|
|
|
|
- // IBUTTON_APP_FOLDER, IBUTTON_APP_FILENAME_EXTENSION, ibutton->key_name);
|
|
|
|
|
- // text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
|
|
|
|
|
-
|
|
|
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, HexViewerSceneScene_1);
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, HexViewerSceneScene_1);
|
|
|
-
|
|
|
|
|
- // if(success) {
|
|
|
|
|
- // //
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- // if(success) {
|
|
|
|
|
- // // Load page to do something with result
|
|
|
|
|
- // //scene_manager_next_scene(app->scene_manager, HexViewerViewIdMenu);
|
|
|
|
|
- // //scene_manager_previous_scene(app->scene_manager); // temp for showcase
|
|
|
|
|
- // scene_manager_search_and_switch_to_previous_scene(
|
|
|
|
|
- // app->scene_manager, HexViewerViewIdStartscreen);
|
|
|
|
|
- // } else {
|
|
|
|
|
- // // This is basically if someone quites the browser
|
|
|
|
|
- // scene_manager_previous_scene(app->scene_manager);
|
|
|
|
|
- // }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool hex_viewer_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
|
|
bool hex_viewer_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
|
|
@@ -52,7 +33,6 @@ bool hex_viewer_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
if(event.event == HexViewerCustomEventMenuPercentEntered) {
|
|
if(event.event == HexViewerCustomEventMenuPercentEntered) {
|
|
|
int ipercent = atoi(app->percent_buf);
|
|
int ipercent = atoi(app->percent_buf);
|
|
|
- // float percent = atof(app->percent_buf);
|
|
|
|
|
ipercent = MIN(ipercent, 100);
|
|
ipercent = MIN(ipercent, 100);
|
|
|
ipercent = MAX(ipercent, 0);
|
|
ipercent = MAX(ipercent, 0);
|
|
|
float percent = ipercent / 100.0;
|
|
float percent = ipercent / 100.0;
|
|
@@ -62,18 +42,6 @@ bool hex_viewer_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
|
|
|
uint32_t scrollable_lines = line_count - HEX_VIEWER_LINES_ON_SCREEN;
|
|
uint32_t scrollable_lines = line_count - HEX_VIEWER_LINES_ON_SCREEN;
|
|
|
uint32_t target_line = (uint32_t)(percent * scrollable_lines);
|
|
uint32_t target_line = (uint32_t)(percent * scrollable_lines);
|
|
|
|
|
|
|
|
- // uint32_t first_line_on_screen = model->file_offset / HEX_VIEWER_BYTES_PER_LINE;
|
|
|
|
|
- // if(line_count > HEX_VIEWER_LINES_ON_SCREEN) {
|
|
|
|
|
- // uint8_t width = canvas_width(canvas);
|
|
|
|
|
- // elements_scrollbar_pos(
|
|
|
|
|
- // canvas,
|
|
|
|
|
- // width,
|
|
|
|
|
- // 0,
|
|
|
|
|
- // ROW_HEIGHT * HEX_VIEWER_LINES_ON_SCREEN,
|
|
|
|
|
- // first_line_on_screen, // TODO
|
|
|
|
|
- // line_count - (HEX_VIEWER_LINES_ON_SCREEN - 1));
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
uint32_t new_file_offset = target_line * HEX_VIEWER_BYTES_PER_LINE;
|
|
uint32_t new_file_offset = target_line * HEX_VIEWER_BYTES_PER_LINE;
|
|
|
if(app->model->file_size > new_file_offset) {
|
|
if(app->model->file_size > new_file_offset) {
|
|
|
app->model->file_offset = new_file_offset;
|
|
app->model->file_offset = new_file_offset;
|