Example #1
0
int SimpleUserQueryEx( TEXTSTR result, int reslen, CTEXTSTR question, PSI_CONTROL pAbove, void (CPROC*query_success_callback)(uintptr_t, LOGICAL), uintptr_t query_user_data )
{
	PSI_CONTROL pf, pc;
	struct user_query_info *query_state = New( struct user_query_info );
	int32_t mouse_x, mouse_y;

	//int Done = FALSE, Okay = FALSE;
	pf = CreateFrame( NULL, 0, 0, 280, 65, 0, pAbove );
	SetCommonUserData( pf, (uintptr_t)query_state );
	query_state->pf = pf;
	query_state->Done = FALSE;
	query_state->Okay = FALSE;
	query_state->result = result;
	query_state->reslen = reslen;
	pc = MakeTextControl( pf, 5, 2, 320, 18, TXT_STATIC, question, TEXT_NORMAL );

	query_state->edit = MakeEditControl( pf, 5, 23, 270, 14, TXT_STATIC, NULL, 0 );
	AddCommonButtons( pf, &query_state->Done, &query_state->Okay );
	SetButtonPushMethod( GetControl( pf, IDOK ), OkayClicked, (uintptr_t)query_state );
	SetButtonPushMethod( GetControl( pf, IDCANCEL ), CancelClicked, (uintptr_t)query_state );
	GetMousePosition( &mouse_x, &mouse_y );
	MoveFrame( pf, mouse_x - 140, mouse_y - 30 );
	//lprintf( WIDE("Show query....") );
	DisplayFrame( pf );
	SetCommonFocus( query_state->edit );

	query_state->query_success = query_success_callback;
	if( !query_success_callback )
	{
		int okay;
		CommonWait( pf );
		if( query_state->Okay )
		{
			GetControlText( query_state->edit, result, reslen );
		}
		DestroyFrame( &pf );
		okay = query_state->Okay;
		Release( query_state );
		return okay;
	}
	else
	{
		query_state->query_success = query_success_callback;
		query_state->query_user_data = query_user_data;
		return 0;
	}

}
Example #2
0
void ShowMediaPanel( struct my_button *media )
{
    INDEX idx;
    struct media_control_panel *panel;
    LIST_FORALL( l.controls, idx, struct media_control_panel *, panel )
    {
        if( panel->media == media )
            break;
    }
    if( !panel )
    {
        PSI_CONTROL newPanel = MakeNamedControl( NULL, MyName, 0, 0, 500, 75, -1 );
        MyValidatedControlData(struct media_control_panel*,  new_panel, newPanel );
        panel = new_panel;
        panel->media = media;
        panel->flags.playing = 1; // is playing, otherwise media panel wouldn't be showing...
        panel->knob = MakeNamedControl( newPanel, CONTROL_SCROLL_KNOB_NAME, 0, 0, 50, 50, -1 );
        panel->knob_image = LoadImageFile( WIDE( "images/dial2a.png" ) );
        SetScrollKnobImage( panel->knob, panel->knob_image );
        SetScrollKnobEvent( panel->knob, KnobTick, (uintptr_t)panel );
        panel->stop_button = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 0, 50, 25, -1, "Stop" );
        SetButtonPushMethod( panel->stop_button, stop_pushed, (uintptr_t)panel );
#ifdef _DEBUG
        panel->debug_mem_button = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 100, 55, 100, 25, -1, "Debug Memory" );
        SetButtonPushMethod( panel->debug_mem_button, debug_mem, (uintptr_t)panel );
#endif
        panel->pause_button = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 25, 50, 25, -1, "Pause" );
        SetButtonPushMethod( panel->pause_button, pause_pushed, (uintptr_t)panel );
        panel->progress = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 50, 50, 25, -1, "???" );
        //panel->progress = MakeNamedCaptionedControl( newPanel, WIDE( "Button" ), 50, 75, 50, 25, -1, "???" );
        panel->seek_slider = MakeNamedControl( newPanel, SLIDER_CONTROL_NAME,100, 0, 400, 50, -1 );
        SetSliderOptions( panel->seek_slider, SLIDER_HORIZ );
        SetSliderValues( panel->seek_slider, 0, 0, 10000 );  // 100.00%
        SetSliderUpdateHandler( panel->seek_slider, seek_changed, (uintptr_t)panel );
        DisplayFrame( newPanel );
    }
    else
    {
        // have an existing panel to just show.
        RevealCommon( panel->panel );
    }
    ffmpeg_SetPositionUpdateCallback( panel->media->file, video_position_update, (uintptr_t)panel );
}
Example #3
0
static void ConfigureMacroButton( PMACRO_BUTTON button, PSI_CONTROL parent )
{
	PSI_CONTROL frame = LoadXMLFrameOver( parent, WIDE( "ConfigureMacroButton.isFrame" ) );
	if( frame )
	{
		int okay = 0;
		int done = 0;
		l.configuration_parent = parent;
		SetCommonButtons( frame, &done, &okay );
		{
			PSI_CONTROL list;
			SetListboxIsTree( list = GetControl( frame, LIST_CONTROL_TYPES ), 1 );
			ResetList( list );
			FillControlsList( list, 1, TASK_PREFIX WIDE( "/control" ), NULL );
			SetCommonButtonControls( frame );
			SetButtonPushMethod( GetControl( frame, BUTTON_ADD_CONTROL ), AddButtonType, (uintptr_t)button );
			//SetButtonPushMethod( GetControl( frame, BUTTON_EDIT_CONTROL ), AddButtonType, (uintptr_t)button );
			{
				PSI_CONTROL list = GetControl( frame, LIST_MACRO_ELEMENTS );
				if( list )
				{
					PMACRO_ELEMENT pme = button->elements;
					while( pme )
					{
						SetItemData( AddListItem( list, (pme->button->text&&pme->button->text[0])?pme->button->text:pme->button->pTypeName ), (uintptr_t)pme );
						pme = NextThing( pme );
					}
				}
			}
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_UP ), MoveElementUp, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_CLONE ), MoveElementClone, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_CLONE_ELEMENT ), CloneElement, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_DOWN ), MoveElementDown, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_CONFIGURE ), ConfigureElement, (uintptr_t)button );
			SetButtonPushMethod( GetControl( frame, BUTTON_ELEMENT_REMOVE ), MoveElementRemove, (uintptr_t)button );
		}
		DisplayFrameOver( frame, parent );
		CommonWait( frame );
		if( okay )
		{
			GetCommonButtonControls( frame );
		}
		DestroyFrame( &frame );
	}
}