Beispiel #1
0
disasmwin_info::disasmwin_info(debugger_windows_interface &debugger) :
	disasmbasewin_info(debugger, false, "Disassembly", NULL),
	m_combownd(NULL)
{
	if ((window() == NULL) || (m_views[0] == NULL))
		return;

	// set up the view to track the initial expression
	set_edit_defstr("curpc");
	set_editwnd_text("curpc");
	editwnd_select_all();

	// create a combo box
	m_combownd = m_views[0]->create_source_combobox(window(), (LONG_PTR)this);

	// set the caption
	update_caption();

	// recompute the children once to get the maxwidth
	disasmwin_info::recompute_children();

	// position the window and recompute children again
	SetWindowPos(window(), HWND_TOP, 100, 100, maxwidth(), 200, SWP_SHOWWINDOW);
	disasmwin_info::recompute_children();

	// mark the edit box as the default focus and set it
	editwin_info::set_default_focus();
}
void list_caption_updater::set_total_count ( int val )
{
    if ( total_count_ == val)
        return;
    total_count_ = val;
    update_caption();
}
void list_caption_updater::set_visible_count ( int val )
{
    if ( visible_count_ == val)
        return;
    visible_count_ = val;
    update_caption();
}
list_caption_updater::list_caption_updater(QWidget* widget, const QString& caption)
: widget_(widget)
, caption_(caption)
, visible_count_(0)
, total_count_(0)
{
    update_caption();
}
Beispiel #5
0
memorywin_info::memorywin_info(debugger_windows_interface &debugger) :
	editwin_info(debugger, false, "Memory", NULL),
	m_combownd(NULL)
{
	if (!window())
		return;

	m_views[0].reset(global_alloc(memoryview_info(debugger, *this, window())));
	if ((m_views[0] == NULL) || !m_views[0]->is_valid())
	{
		m_views[0].reset();
		return;
	}

	// create the options menu
	HMENU const optionsmenu = CreatePopupMenu();
	AppendMenu(optionsmenu, MF_ENABLED, ID_1_BYTE_CHUNKS, TEXT("1-byte chunks\tCtrl+1"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_2_BYTE_CHUNKS, TEXT("2-byte chunks\tCtrl+2"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_4_BYTE_CHUNKS, TEXT("4-byte chunks\tCtrl+4"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_8_BYTE_CHUNKS, TEXT("8-byte chunks\tCtrl+8"));
	AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
	AppendMenu(optionsmenu, MF_ENABLED, ID_LOGICAL_ADDRESSES, TEXT("Logical Addresses\tCtrl+L"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_PHYSICAL_ADDRESSES, TEXT("Physical Addresses\tCtrl+Y"));
	AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
	AppendMenu(optionsmenu, MF_ENABLED, ID_REVERSE_VIEW, TEXT("Reverse View\tCtrl+R"));
	AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
	AppendMenu(optionsmenu, MF_ENABLED, ID_INCREASE_MEM_WIDTH, TEXT("Increase bytes per line\tCtrl+P"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_DECREASE_MEM_WIDTH, TEXT("Decrease bytes per line\tCtrl+O"));
	AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)optionsmenu, TEXT("Options"));

	// set up the view to track the initial expression
	downcast<memoryview_info *>(m_views[0].get())->set_expression("0");
	set_edit_defstr("0");
	set_editwnd_text("0");
	editwnd_select_all();

	// create a combo box
	m_views[0]->set_source_for_visible_cpu();
	m_combownd = m_views[0]->create_source_combobox(window(), (LONG_PTR)this);

	// set the caption
	update_caption();

	// recompute the children once to get the maxwidth
	recompute_children();

	// position the window and recompute children again
	SetWindowPos(window(), HWND_TOP, 100, 100, maxwidth(), 200, SWP_SHOWWINDOW);
	recompute_children();

	// mark the edit box as the default focus and set it
	set_default_focus();
}
Beispiel #6
0
bool disasmwin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
	switch (HIWORD(wparam))
	{
	// combo box selection changed
	case CBN_SELCHANGE:
		{
			int const sel = SendMessage((HWND)lparam, CB_GETCURSEL, 0, 0);
			if (sel != CB_ERR)
			{
				m_views[0]->set_source_index(sel);
				update_caption();

				// reset the focus
				set_default_focus();
				return true;
			}
			break;
		}
	}
	return disasmbasewin_info::handle_command(wparam, lparam);
}
Beispiel #7
0
int Commercials::
scan_video()
{
	Tracks *tracks = mwindow->edl->tracks;
	for( Track *vtrk=tracks->first; !cancelled && vtrk; vtrk=vtrk->next) {
		if( vtrk->data_type != TRACK_VIDEO ) continue;
		if( !vtrk->record ) continue;
		Edits *edits = vtrk->edits;  Edit *next = 0;
		for( Edit *edit=edits->first; !cancelled && edit; edit=next ) {
			next = edit->next;
			Indexable *indexable = edit->get_source();
			if( !indexable || !indexable->is_asset ) continue;
			Asset *asset = (Asset *)indexable;
			if( update_caption(edit->channel+1,
				edits->number_of(edit), asset->path) ) break;
			if( read_ads(asset->path) ) continue;
			if( scan_asset(asset, vtrk, edit) ) continue;
			next = edits->first;
		}
		edits->optimize();
	}
	return 0;
}
Beispiel #8
0
bool memorywin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
	memoryview_info *const memview = downcast<memoryview_info *>(m_views[0].get());
	switch (HIWORD(wparam))
	{
	// combo box selection changed
	case CBN_SELCHANGE:
		{
			int const sel = SendMessage((HWND)lparam, CB_GETCURSEL, 0, 0);
			if (sel != CB_ERR)
			{
				memview->set_source_index(sel);
				update_caption();

				// reset the focus
				set_default_focus();
				return true;
			}
			break;
		}

	// menu selections
	case 0:
		switch (LOWORD(wparam))
		{
		case ID_1_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(1);
			return true;

		case ID_2_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(2);
			return true;

		case ID_4_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(4);
			return true;

		case ID_8_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(8);
			return true;

		case ID_LOGICAL_ADDRESSES:
			memview->set_physical(false);
			return true;

		case ID_PHYSICAL_ADDRESSES:
			memview->set_physical(true);
			return true;

		case ID_REVERSE_VIEW:
			memview->set_reverse(!memview->reverse());
			return true;

		case ID_INCREASE_MEM_WIDTH:
			memview->set_chunks_per_row(memview->chunks_per_row() + 1);
			recompute_children();
			return true;

		case ID_DECREASE_MEM_WIDTH:
			memview->set_chunks_per_row(memview->chunks_per_row() - 1);
			recompute_children();
			return true;
		}
		break;
	}
	return editwin_info::handle_command(wparam, lparam);
}
Beispiel #9
0
static void cb_in_received_handler(DictionaryIterator *iter, void *context) {

	APP_LOG(APP_LOG_LEVEL_DEBUG, "Incoming data");

	// Reset
	ErrorExists = 0;
    text_layer_set_text(error_text_layer, "");

	// Set any messages
    Tuple *message_tuple = dict_find(iter, KEY_MESSAGE);
    if(message_tuple){
        strcpy(msg_str, message_tuple->value->cstring);
        text_layer_set_text(message_text_layer, msg_str);
        layer_mark_dirty(text_layer_get_layer(message_text_layer));
    }

    // Get the bitmap
    Tuple *size_tuple  = dict_find(iter, KEY_SIZE);
    if(size_tuple){
        if(data_image)
            free(data_image);
            data_size = size_tuple->value->uint32;
            data_image = malloc(data_size);
    }

	// Set the image
    Tuple *image_tuple = dict_find(iter, KEY_IMAGE);
    Tuple *index_tuple = dict_find(iter, KEY_INDEX);
    if (index_tuple && image_tuple) {
        int32_t index = index_tuple->value->int32;
        //APP_LOG(APP_LOG_LEVEL_DEBUG, "image received index=%ld size=%d", index, image_tuple->length);
        memcpy(data_image + index,&image_tuple->value->uint8,image_tuple->length);
        if(image_tuple->length < CHUNK_SIZE){

			// Clear the image
			if(image){
				gbitmap_destroy(image);
				image = NULL;
			}

            #ifdef PBL_COLOR
            	image = gbitmap_create_from_png_data(data_image, data_size);
            #else
            	image = gbitmap_create_with_data(data_image);
            #endif

            bitmap_layer_set_bitmap(image_layer, image);
            layer_mark_dirty(bitmap_layer_get_layer(image_layer));
			text_layer_set_text(message_text_layer,"");
            layer_mark_dirty(text_layer_get_layer(message_text_layer));

            vibes_short_pulse();
            light_enable_interaction();

            ImgLoaded = 1;
            Loading = 0;

            text_layer_set_text(username_text_layer, usr_str);
    		text_layer_set_background_color(username_text_layer, GColorWhite);
    		if(ErrorExists == 1){
    			text_layer_set_background_color(username_text_layer, GColorClear);
    		}
            layer_mark_dirty(text_layer_get_layer(username_text_layer));
        }
    }

	// Set any errors
    Tuple *error_tuple = dict_find(iter, KEY_ERROR);
    if(error_tuple){
        text_layer_set_text(message_text_layer,"");
        layer_mark_dirty(text_layer_get_layer(message_text_layer));

		// Clear the image
		if(image){
    		gbitmap_destroy(image);
            if(data_image){
                free(data_image);
            }
			image = NULL;
    		bitmap_layer_set_bitmap(image_layer, image);
		}

        Loading = 0;
		ErrorExists = 1;
		#ifdef PBL_COLOR
			image = gbitmap_create_with_resource(RESOURCE_ID_ERROR_B);
            text_layer_set_text_color(error_text_layer, GColorBlack);
		#else
			image = gbitmap_create_with_resource(RESOURCE_ID_ERROR_A);
		#endif
		bitmap_layer_set_bitmap(image_layer, image);
        layer_mark_dirty(bitmap_layer_get_layer(image_layer));
        text_layer_set_text(error_text_layer, error_tuple->value->cstring);
        layer_mark_dirty(text_layer_get_layer(error_text_layer));
        vibes_short_pulse();
        light_enable_interaction();
    }

	// Prepare the username
    Tuple *username_tuple = dict_find(iter, KEY_USERNAME);
    if(username_tuple){
        strcpy(usr_str, username_tuple->value->cstring);
		prepend(usr_str, " ");
        //text_layer_set_text(username_text_layer, usr_str);
    }

	// Set the likes
	Tuple *likes_tuple = dict_find(iter, KEY_LIKES);
    if(likes_tuple){
        strcpy(likes_str, likes_tuple->value->cstring);
		update_likes(likes_str);
    }

	// Set the comments
	Tuple *comments_tuple = dict_find(iter, KEY_COMMENTS);
    if(comments_tuple){
        strcpy(comments_str, comments_tuple->value->cstring);
		update_comments(comments_str);
    }

	// Set the caption
	Tuple *caption_tuple = dict_find(iter, KEY_CAPTION);
    if(caption_tuple){
        strcpy(capt_str, caption_tuple->value->cstring);
		update_caption(capt_str);
    }

}