Esempio n. 1
0
NET_API_STATUS
GetBrowserTransportList(
    OUT PLMDR_TRANSPORT_LIST *TransportList
    )

/*++

Routine Description:

    This routine returns the list of transports bound into the browser.

Arguments:

    OUT PLMDR_TRANSPORT_LIST *TransportList - Transport list to return.

Return Value:

    NET_API_STATUS - NERR_Success or reason for failure.

--*/

{

    NET_API_STATUS Status;
    HANDLE BrowserHandle;
    LMDR_REQUEST_PACKET RequestPacket;

    Status = OpenBrowser(&BrowserHandle);

    if (Status != NERR_Success) {
        return Status;
    }

    RequestPacket.Version = LMDR_REQUEST_PACKET_VERSION;

    RequestPacket.Type = EnumerateXports;

    RtlInitUnicodeString(&RequestPacket.TransportName, NULL);
#ifdef _CAIRO_
    RtlInitUnicodeString(&RequestPacket.EmulatedDomainName, NULL);
#endif // _CAIRO_

    Status = DeviceControlGetInfo(
                BrowserHandle,
                IOCTL_LMDR_ENUMERATE_TRANSPORTS,
                &RequestPacket,
                sizeof(RequestPacket),
                (PVOID *)TransportList,
                0xffffffff,
                4096,
                NULL);

    NtClose(BrowserHandle);

    return Status;
}
Esempio n. 2
0
//---------------------------------------------------------------------------
void __fastcall TWebHelpSystem::ShowHelp(const UnicodeString AHelpString)
{
  UnicodeString HelpUrl;
  if (IsHttpUrl(AHelpString))
  {
    HelpUrl = AHelpString;
  }
  else
  {
    // see also AppendUrlParams
    UnicodeString HelpString = AHelpString;
    const wchar_t FragmentSeparator = L'#';
    UnicodeString HelpPath = CutToChar(HelpString, FragmentSeparator, false);
    HelpUrl = FMTLOAD(DOCUMENTATION_KEYWORD_URL2, (HelpPath, FVersion, FLanguage));
    AddToList(HelpUrl, HelpString, FragmentSeparator);
  }
  OpenBrowser(HelpUrl);
}
Esempio n. 3
0
//---------------------------------------------------------------------------
void __fastcall TWebHelpSystem::ShowTableOfContents()
{
  OpenBrowser(FMTLOAD(DOCUMENTATION_URL2, (FVersion, FLanguage)));
}
Esempio n. 4
0
//---------------------------------------------------------------------------
void __fastcall SearchHelp(const UnicodeString & Message)
{
  OpenBrowser(FMTLOAD(DOCUMENTATION_SEARCH_URL2,
    (EncodeUrlString(Message), Configuration->ProductVersion,
     IntToHex(__int64(GUIConfiguration->Locale), 4))));
}
	virtual void OnClick(Point pt, int widget, int click_count)
	{
		if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_END) {
			if (this->selected == NULL || this->selected->state != ContentInfo::ALREADY_HERE) return;

			ShowContentTextfileWindow((TextfileType)(widget - WID_NCL_TEXTFILE), this->selected);
			return;
		}

		switch (widget) {
			case WID_NCL_MATRIX: {
				uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NCL_MATRIX);
				if (id_v >= this->content.Length()) return; // click out of bounds

				this->selected = *this->content.Get(id_v);
				this->list_pos = id_v;

				const NWidgetBase *checkbox = this->GetWidget<NWidgetBase>(WID_NCL_CHECKBOX);
				if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
					_network_content_client.ToggleSelectedState(this->selected);
					this->content.ForceResort();
				}

				this->InvalidateData();
				break;
			}

			case WID_NCL_CHECKBOX:
			case WID_NCL_TYPE:
			case WID_NCL_NAME:
				if (this->content.SortType() == widget - WID_NCL_CHECKBOX) {
					this->content.ToggleSortOrder();
					this->list_pos = this->content.Length() - this->list_pos - 1;
				} else {
					this->content.SetSortType(widget - WID_NCL_CHECKBOX);
					this->content.ForceResort();
					this->SortContentList();
				}
				this->ScrollToSelected();
				this->InvalidateData();
				break;

			case WID_NCL_SELECT_ALL:
				_network_content_client.SelectAll();
				this->InvalidateData();
				break;

			case WID_NCL_SELECT_UPDATE:
				_network_content_client.SelectUpgrade();
				this->InvalidateData();
				break;

			case WID_NCL_UNSELECT:
				_network_content_client.UnselectAll();
				this->InvalidateData();
				break;

			case WID_NCL_CANCEL:
				delete this;
				break;

			case WID_NCL_OPEN_URL:
				if (this->selected != NULL) {
					extern void OpenBrowser(const char *url);
					OpenBrowser(this->selected->url);
				}
				break;

			case WID_NCL_DOWNLOAD:
				if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD) == NULL) new NetworkContentDownloadStatusWindow();
				break;
		}
	}
LRESULT CALLBACK About( HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam )
{
#define TIMER_ID_ABOUT (UINT) 'A'
	const RECT urlrect = { 90, 140, 320, 170 };

	static HCURSOR hCursor[ 3 ];
	static int iCursor = 0;
	static int iMouseDown = 0;
	static HWND hWnd = NULL;

	static HFONT hBold;
	static TCHAR lpszWindowText[ 1024 ];
	switch ( uMessage )
	{
		case WM_INITDIALOG:
		{
			hWnd = (HWND) lParam;

			
			HDC hDC = GetDC( hDlg );
			hBold = MyCreateFont( hDC, TEXT( "Georgia" ), 14, TRUE, TRUE );
			if( !hBold ) hBold = MyCreateFont( hDC, TEXT( "Times New Roman" ), 16, TRUE, TRUE );
			ReleaseDC( hDlg, hDC );

			SetDlgItemText( hDlg, IDC_APP_NAME , APP_NAME );
			SendDlgItemMessage( hDlg, IDC_APP_NAME, WM_SETFONT, ( WPARAM ) hBold, 0L );
			SendDlgItemMessage( hDlg, IDC_DESCRIPTION, WM_SETFONT, ( WPARAM ) hFont, 0L );
			TCHAR str[ 1024 ];
			wsprintf( str, TEXT( "Compiled on: %hs, %hs UTC" ), __TIME__, __DATE__ );
			SetDlgItemText( hDlg, IDC_DATETIME , str );
			SetDlgItemText( hDlg, IDC_COPYRIGHT , APP_COPYRIGHT );

			SendDlgItemMessage( hDlg, IDC_EDITBOX_GPL, EM_SETMARGINS,
				(WPARAM) ( EC_LEFTMARGIN | EC_RIGHTMARGIN ),
				MAKELPARAM( 5 , 10 )
			);


#ifdef _UNICODE
			SetDlgItemText( hDlg, IDC_DESCRIPTION2 , TEXT( "Unicode Build" ) );
#else
			SetDlgItemText( hDlg, IDC_DESCRIPTION2 , TEXT( "ANSI (Non-unicode) Build" ) );
#endif
			
#ifdef _UNICODE
			if( IS_JAPANESE )
			{
				lpszWindowText[ 0 ] = TEXT( '\0' ); // just in case
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_JPN_9000, -1, lpszWindowText, 1023 );
				SetWindowText( hDlg, lpszWindowText );

				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_JPN_DESC, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_DESCRIPTION, str );

				SendDlgItemMessage( hDlg, IDC_EDITBOX_GPL, WM_SETFONT, ( WPARAM ) hFont, 0L );
				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_JPN_GPL, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, str );
			}
			else if( IS_FINNISH )
			{
				lpszWindowText[ 0 ] = TEXT( '\0' ); // just in case
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_FIN_9000, -1, lpszWindowText, 1023 );
				SetWindowText( hDlg, lpszWindowText );

				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_FIN_DESC, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_DESCRIPTION, str );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, TEXT_GPL );
			}
			else if( IS_SPANISH )
			{
				lpszWindowText[ 0 ] = TEXT( '\0' ); // just in case
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_SPA_9000, -1, lpszWindowText, 1023 );
				SetWindowText( hDlg, lpszWindowText );

				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_SPA_DESC, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_DESCRIPTION, str );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, TEXT_GPL );
			}
			else if( IS_CHINESE_T )
			{
				lpszWindowText[ 0 ] = TEXT( '\0' ); // just in case
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_CHI_9000T, -1, lpszWindowText, 1023 );
				SetWindowText( hDlg, lpszWindowText );

				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_CHI_DESC_T, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_DESCRIPTION, str );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, TEXT_GPL );
			}
			else if( IS_CHINESE_S )
			{
				lpszWindowText[ 0 ] = TEXT( '\0' ); // just in case
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_CHI_9000S, -1, lpszWindowText, 1023 );
				SetWindowText( hDlg, lpszWindowText );

				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_CHI_DESC_S, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_DESCRIPTION, str );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, TEXT_GPL );
			}
			else if( IS_FRENCH )
			{
				lpszWindowText[ 0 ] = TEXT( '\0' ); // just in case
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_FRE_9000, -1, lpszWindowText, 1023 );
				SetWindowText( hDlg, lpszWindowText );

				str[ 0 ] = TEXT( '\0' );
				MultiByteToWideChar( CP_UTF8, MB_CUTE, S_FRE_DESC, -1, str, 1023 );
				SetDlgItemText( hDlg, IDC_DESCRIPTION, str );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, TEXT_GPL );
			}
			else
#endif
			{
				SetDlgItemText( hDlg, IDC_DESCRIPTION, S_ENG_DESC );
				SetDlgItemText( hDlg, IDC_EDITBOX_GPL, TEXT_GPL );
				lstrcpy( lpszWindowText, TEXT( "About..." ) );
				SetWindowText( hDlg, lpszWindowText );
			}

			char hcSstpVersion[ 1024 ] = "";

#ifdef _UNICODE
			WideCharToMultiByte(
					CP_ACP,
					0,
					APP_NAME,
					-1,
					hcSstpVersion,
					1023,
					NULL,
					NULL
			);
#else
			lstrcpyA( hcSstpVersion, APP_NAME );
#endif
			lstrcatA( hcSstpVersion, "\\nCompiled on: " );
			lstrcatA( hcSstpVersion, __TIME__ );
			lstrcatA( hcSstpVersion, "+00:00, " );
			lstrcatA( hcSstpVersion, __DATE__ );

#ifdef _UNICODE
			if( IS_JAPANESE && ( LANG_JAPANESE == PRIMARYLANGID( GetSystemDefaultLangID() ) ) )
#else
			if( LANG_JAPANESE == PRIMARYLANGID( GetSystemDefaultLangID() ) )
#endif
			{
				DirectSSTP( (HWND) lParam, S_ABOUT_SJIS, hcSstpVersion, "Shift_JIS" );
			}
			else
			{
				DirectSSTP( (HWND) lParam, "About 'Battle Encoder Shirase'...", hcSstpVersion, "ASCII" );
			}


			hCursor[ 0 ] = LoadCursor( ( HINSTANCE ) NULL, IDC_ARROW );
			hCursor[ 1 ] = LoadCursor( ( HINSTANCE ) NULL, IDC_HAND );
			hCursor[ 2 ] = hCursor[ 1 ];
			SetCursor( hCursor[ 0 ] );

			// Anti-Ukagaka
			SetTimer( hDlg, TIMER_ID_ABOUT, 500U, (TIMERPROC) NULL );
			break;
		}
		case WM_COMMAND:
		{
			if( LOWORD( wParam ) == IDOK || LOWORD( wParam ) == IDCANCEL ) 
			{
				EndDialog( hDlg, -1 );
				return TRUE;
			}
			break;
		}
		case WM_TIMER:
		{
			SetWindowText( hDlg, lpszWindowText );
			break;
		}
		case WM_MOUSEMOVE:
		{
			if( iMouseDown == -1 ) break;

			int iPrevCursor = iCursor;
			iCursor = AboutBoxUrlHit( lParam );

			// Reset Cursor for each WM_MOUSEMOVE, silly but...
			SetCursor( hCursor[ iCursor ] );

			if( iCursor == 1 && iMouseDown == 1 ) iCursor = 2;

			
			if( iPrevCursor != iCursor )
			{
/*
				// In theory, we have to change Cursor only when Prev!=Now, but
				// something is wrong here and that doesn't work.
				SetCursor( hCursor[ iCursor ] );
*/
				InvalidateRect( hDlg, &urlrect, TRUE );
			}
			break;
		}

		case WM_LBUTTONDOWN:
		{
			SetCapture( hDlg );
			
			if( AboutBoxUrlHit( lParam ) )
			{
				iMouseDown = 1;
				SetCursor( hCursor[ 1 ] );
				iCursor = 2;
				InvalidateRect( hDlg, &urlrect, TRUE );
			}
			else
			{
				iMouseDown = -1;
			}
			break;
		}

		case WM_LBUTTONUP:
		{
			ReleaseCapture();
			
			if( iMouseDown == 1 && AboutBoxUrlHit( lParam ) )
			{
				OpenBrowser( APP_HOME_URL );
			}

			iCursor = 0;
			SetCursor( hCursor[ 0 ] );
			iMouseDown = 0;
			break;
		}


		case WM_ACTIVATE:
		{
			if( wParam == WA_INACTIVE )
			{
				iMouseDown = -1;
				iCursor = 0;
				SetCursor( hCursor[ 0 ] );
				InvalidateRect( hDlg, &urlrect, TRUE );
			}
			else
			{
				iMouseDown = 0;
			}
			break;
		}
		case WM_PAINT:
		{
			PAINTSTRUCT ps;
			HDC hdc = BeginPaint( hDlg, &ps );
			HFONT hMyFont = GetFontForURL( hdc );
			HFONT hOldFont = (HFONT) SelectObject( hdc, hMyFont );

			SetBkMode( hdc, TRANSPARENT );
			SetTextColor( hdc,
				iCursor == 2 ? RGB( 0xff, 0x00, 0x00 ) :
				iCursor == 1 ? RGB( 0x00, 0x80, 0x00 ) : RGB( 0x00, 0x00, 0xff ) );
			TextOut( hdc, 100, 148, APP_HOME_URL, lstrlen( APP_HOME_URL ) );
			SelectObject( hdc, hOldFont );
			DeleteFont( hMyFont );
			EndPaint( hDlg, &ps );
			break;
		}

		case WM_CTLCOLORSTATIC:
		{
			if( (HWND) lParam == GetDlgItem( hDlg, IDC_APP_NAME ) )
			{
				HDC hDC = (HDC) wParam;
				SetBkMode( hDC, TRANSPARENT );
				SetBkColor( hDC, GetSysColor( COLOR_3DFACE ) );
				SetTextColor( hDC, RGB( 0,0,0xa0 ) );
				return (BOOL) (HBRUSH) GetSysColorBrush( COLOR_3DFACE );
			}
			else return FALSE;
			break;
		}
		case WM_DESTROY:
		{
			DeleteFont( hBold );
			hBold = NULL;
			KillTimer( hDlg, TIMER_ID_ABOUT );
			break;
		}
		default:
		{
			return 0L;
		}
	}
    return 1L;
}