Exemple #1
0
Ctrl& DockBase::Dock(DockableCtrl& ctrl)
{
    int alignment = ctrl.Alignment();
    // Register ctrl.
    ctrl.SetBase(this);
	AddCtrlRecord(ctrl);
	// Dock...
     switch(alignment)
   	{
       		case DockableCtrl::DOCK_LEFT:
          			GetPaneFrame(alignment).Attach(ctrl).Vert();
  		 		break;  
            case DockableCtrl::DOCK_TOP:
                    GetPaneFrame(alignment).Attach(ctrl).Horz();
                break;
            case DockableCtrl::DOCK_RIGHT:
                    GetPaneFrame(alignment).Attach(ctrl).Vert();
                break;
            case DockableCtrl::DOCK_BOTTOM:
                    GetPaneFrame(alignment).Attach(ctrl).Horz();
                break;
             default:
             	if(ctrl.IsFloating())
             	{
             		ctrl.CenterOwner();
             		ctrl.SetSize(panesize);
             		ctrl.FloatEx(Rect(0, 0, panesize.cx / 4, panesize.cy / 3));
             		ctrl.NoCenter();
             	}
                break;
   	}
	RefreshPanel();
	return *this;
}
Exemple #2
0
void DockBase::ControlPanel()
{
    if(controlpanel.IsOpen()) return;
    controlpanel.Open(GetTopWindow());
   	RefreshGroups();
    RefreshPanel(); 
}
Exemple #3
0
static int InpdX2Init()
{
	char szText[128];
	unsigned int temp=0;

	// Set the dialog title
	sprintf(szText,"Edit %.100s",pInpdX2DIPSWInfo->szDIPSWName);
	SetWindowText(hInpdX2Dlg,szText);
	temp = (unsigned char)(~*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]&pInpdX2DIPSWInfo->nDIPSWMask);
	// if not the "enabled" value then it must be disabled
	bEnabled=(unsigned char)(pInpdX2DIPSWInfo->pDIPSWChoice->nChoiceWriteValue==temp);
	RefreshPanel();
	return 0;
}
Exemple #4
0
void DockBase::OnAddNewLayout()
{
	String name;
	if(EditText(name, t_("Add new layout"), t_("Layout name:"), 32))
	{
		if(IsNull(name)) 
		{
			Exclamation(t_("You must enter a name for the new layout"));
			return;
		}
		else if(layouts.Find(name) >= 0)
		{
			if(!PromptOKCancel(Format(t_("Layout '%s' adready exists. Do you want to overwrite it?"), name)))
			return;
		}
		NewWidgetLayout(name);
		RefreshPanel();
	}
}
Exemple #5
0
unsigned int GUI_CB_MyPictures( GUIMenu_t *lpGUIMenu, unsigned int nGUIMsg,
								unsigned int nCtrlParam, unsigned int nOther )
{
	GUIThumbItem_t		*pItem;
	const fileInfo_t	*pFile;
	unsigned int		nRet, nOffset;
	char				szNewPath[MAX_PATH + 1], *pStr;

	switch( nGUIMsg )
	{
		case GUI_MSG_OPEN:
			pErrImage = GUI_MenuGetImage( lpGUIMenu,
				((GUICtrl_Image_t*)GUI_ControlByID(ID_IMAGE_ERROR)->pCtrl)->nTexture );

			pDirImage = GUI_MenuGetImage( lpGUIMenu,
				((GUICtrl_Image_t*)GUI_ControlByID(ID_IMAGE_DIR)->pCtrl)->nTexture );

			if( !szCurDir[0] )
				MyPictures_Init();

			break;

		case GUI_MSG_CLOSE:
			GUI_Ctrl_ThumbnailPanel_VramClean( GUI_ControlByID(ID_THUMBNAIL_PANEL) );
			break;

		case GUI_MSG_CONTROL:
			switch( LOWORD(nCtrlParam) )
			{
				case ID_CACHE_IMAGES:
					GUI_OpenDialog( GUI_MENU_DLGTHUMB, lpGUIMenu, 0 );
					break;

				case ID_SORT_BY_NAME:
					if( nNumFiles )
					{
						qsort( fileInfo, nNumFiles, sizeof(fileInfo_t), SortPanelByName );
						RefreshPanel();
					}
					break;

				case ID_SORT_BY_SIZE:
					if( nNumFiles )
					{
						qsort( fileInfo, nNumFiles, sizeof(fileInfo_t), SortPanelBySize );
						RefreshPanel();
					}
					break;

				case ID_SORT_BY_TYPE:
					break;

				case ID_GO_BACK:
					GUI_OpenMenu( GUI_MENU_MAIN );
					break;

				case ID_THUMBNAIL_PANEL:
					switch( HIWORD(nCtrlParam) )
					{
						case GUI_NOT_NEED_INFO:
							pItem = (GUIThumbItem_t*) nOther;
							pFile = (fileInfo_t*) pItem->pUser;

							pItem->pStr	= pFile->name;

							// device list
							if( !szCurDir[0] )
							{
								if( !strncmp( pFile->name, "pfs", 3 ) )
								{
									pItem->pStr = HDD_GetPartition(pFile->name);
								}
								else if( !strncmp( pFile->name, "smb", 3 ) )
								{
									pItem->pStr = SMB_GetShareNameByPath(pFile->name);
								}
							}

							nRet = CreateThumbnail( pFile, szCurDir, &pItem->pTexture );
							if( nRet == 0 )
								pItem->pTexture = pErrImage->gsTexture;
							break;

						case GUI_NOT_REMOVE:
							pItem = (GUIThumbItem_t*) nOther;

							if( pItem->pTexture )
							{
								if( pItem->pTexture && pItem->pTexture != pErrImage->gsTexture &&
									pItem->pTexture != pDirImage->gsTexture )
									gsLib_texture_free( pItem->pTexture );
							}

							pItem->pTexture = NULL;
							pItem->pStr		= NULL;
							break;

						case GUI_NOT_THUMB:
							pFile = (fileInfo_t*) ((GUIThumbItem_t*)nOther)->pUser;
							pItem = (GUIThumbItem_t*) nOther;

							if( pFile->flags & FLAG_DIRECTORY )
							{
								if( !strcmp( pFile->name, ".." ) )
								{
									if( BrowsingRoot(szCurDir) )
									{
										MyPictures_Init();
										GUI_Render();
										return 0;
									}
									else
									{
										nOffset = strlen(szCurDir) - 1;
										strncpy( szNewPath, szCurDir, nOffset );
										szNewPath[ nOffset ] = 0;

										if( !(pStr = strrchr( szNewPath, '/' )) )
											break;

										nOffset = pStr - szNewPath + 1;
										strncpy( szNewPath, szCurDir, nOffset );
										szNewPath[ nOffset ] = 0;
									}
								}
								else
								{
									snprintf( szNewPath, MAX_PATH, "%s%s", szCurDir,
											  pFile->name );

									if( szNewPath[ strlen(szNewPath) - 1 ] != '/' )
										strncat( szNewPath, "/", MAX_PATH );
								}

								SetBrowseDir( szNewPath );
							}
							else
							{
								// clicked an image thumbnail
								if( pItem->pTexture != pErrImage->gsTexture &&
									pItem->pTexture != pDirImage->gsTexture )
								{
									snprintf( szNewPath, sizeof(szNewPath), "%s%s",
											  szCurDir, pFile->name );

									GUI_OpenViewMenu( szNewPath );
								}
							}
							break;
					}
					break;
			}
			break;
	}

	return 0;
}
Exemple #6
0
void DockBase::ResetWidgetLayout()
{
	controlpanel.layoutlist.SetIndex(layoutindex = 0);
	SetWidgetLayout(layoutindex);
	RefreshPanel();
}
Exemple #7
0
static INT_PTR CALLBACK DialogProc(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam)
{
	(void)lParam;
	(void)wParam;
	(void)hDlg;
	if (Msg==WM_INITDIALOG)
	{
		hInpdX2Dlg=hDlg;    // 1 = we didn't set focus?
		InpdX2Init();
		return 1;
	}
	if (Msg==WM_CLOSE)
	{
		DestroyWindow(hInpdX2Dlg);
		return 0;
	}
	if (Msg==WM_DESTROY)
	{
		InpdX2Exit();
		return 0;
	}

	if (Msg==WM_COMMAND)
	{
		int Id=LOWORD(wParam);
		int Notify=HIWORD(wParam);
		if (Id==IDOK     && Notify==BN_CLICKED)
		{
			SendMessage(hDlg,WM_CLOSE,0,0);    // OK=close
			return 0;
		}
		if (Id==IDCANCEL && Notify==BN_CLICKED)
		{
			SendMessage(hDlg,WM_CLOSE,0,0);    // cancel=close
			return 0;
		}

		if (Id==IDC_RADIO_ENABLED)
		{
			// 1) mask out the previous value
			// 2) OR it with the (user's choice AND mask)
			pgi=GameInp+(nGameInpCount-(68-pInpdX2DIPSWInfo->chDIPSWSlot));
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]&=~pInpdX2DIPSWInfo->nDIPSWMask;
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]|=(~pInpdX2DIPSWInfo->pDIPSWChoice->nChoiceWriteValue&pInpdX2DIPSWInfo->nDIPSWMask);
			pgi->nConst=*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65];

			bEnabled=1;
			pgi->nInput=1;
			InpDIPSWListMake();
			RefreshPanel();
			return 0;
		}

		if (Id==IDC_RADIO_DISABLED)
		{
			// 1) mask out the previous value
			// 2) OR it with the (user's enabled value AND mask)
			pgi=GameInp+(nGameInpCount-(68-pInpdX2DIPSWInfo->chDIPSWSlot));
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]&=~pInpdX2DIPSWInfo->nDIPSWMask;
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]|=(~pInpdX2DIPSWInfo->pDIPSWChoice->pNext->nChoiceWriteValue&pInpdX2DIPSWInfo->nDIPSWMask);
			pgi->nConst=*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65];

			bEnabled=0;
			pgi->nInput=1;
			InpDIPSWListMake();
			RefreshPanel();
			return 0;
		}
	}
	return 0;
}