Пример #1
0
inline
typename enable_if2< is_Mat<vec_type>::value && (is_signed<uT>::value == false), vec_type >::result
regspace
  (
  const typename vec_type::pod_type start,
  const          uT                 delta,
  const typename vec_type::pod_type end
  )
  {
  arma_extra_debug_sigprint();
  arma_extra_debug_print("regspace(): unsigned version");
  
  vec_type x;
  
  if( (delta == uT(+1)) && (start <= end) )
    {
    internal_regspace_default_delta(x, start, end);
    }
  else
    {
    internal_regspace_var_delta(x, start, delta, end);
    }
  
  if(x.n_elem == 0)
    {
    if(is_Mat_only<vec_type>::value)  { x.set_size(1,0); }
    }
  
  return x;
  }
Пример #2
0
inline
typename enable_if2< (is_signed<uT>::value == false), void >::result
internal_regspace_var_delta
  (
  Mat<eT>& x,
  const typename Mat<eT>::pod_type start,
  const          uT                delta,
  const typename Mat<eT>::pod_type end
  )
  {
  arma_extra_debug_sigprint();
  arma_extra_debug_print("internal_regspace_var_delta(): unsigned version");
  
  typedef typename Mat<eT>::pod_type T;
  
  if( ((start > end) && (delta > uT(0))) || (delta == uT(0)) )  { return; }
  
  const bool ascend = (start <= end);
  
  const T inc = T(delta);
  
  const T M = ((ascend) ? T(end-start) : T(start-end)) / T(inc);
  
  const uword N = uword(1) + ( (is_non_integral<T>::value) ? uword(std::floor(double(M))) : uword(M) );
  
  x.set_size(N);
  
  eT* x_mem = x.memptr();
  
  if(ascend)
    {
    for(uword i=0; i < N; ++i) { x_mem[i] = eT( start + T(i*inc) ); }
    }
  else
    {
    for(uword i=0; i < N; ++i) { x_mem[i] = eT( start - T(i*inc) ); }
    }
  }
Пример #3
0
	virtual HWND init(HookProc_t hook)
	{
		{
			OSVERSIONINFOEX osvi;
			memset(&osvi, 0, sizeof(osvi));
			osvi.dwOSVersionInfoSize = sizeof(osvi);
			if (GetVersionEx((LPOSVERSIONINFO)&osvi))
			{
				if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 && osvi.wServicePackMajor == 0)
				{
					pfc::string_formatter message;
					message << "Sorry, your operating system Windows XP ";
					if (!osvi.wServicePackMajor)
						message << "(no service pack installed)";
					else
						message << "Service Pack " << osvi.wServicePackMajor;
					message << " is not supported by Columns UI. Please upgrade to Service Pack 1 or newer and try again.\n\nOtherwise, uninstall the Columns UI component to return to the Default User Interface.",
						MessageBox(NULL, uT(message), _T("Columns UI - Unsupported operating system"), MB_OK | MB_ICONEXCLAMATION);
					return NULL;

				}
			}
		}
		//		performance_counter startup;

		if (main_window::config_get_is_first_run())
		{
			if (!cfg_layout.get_presets().get_count())
				cfg_layout.reset_presets();
		}

		main_window::g_hookproc = hook;


		WNDCLASS  wc;
		memset(&wc, 0, sizeof(wc));

		create_icon_handle();

		wc.lpfnWndProc = (WNDPROC)g_MainWindowProc;
		wc.style = CS_DBLCLKS;
		wc.hInstance = core_api::get_my_instance();
		wc.hIcon = static_api_ptr_t<ui_control>()->get_main_icon();//g_main_icon;
		wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
		wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
		wc.lpszClassName = main_window_class_name;

		ATOM cls = RegisterClass(&wc);

		RECT rc_work;
		SystemParametersInfo(SPI_GETWORKAREA, NULL, &rc_work, NULL);

		const unsigned cx = (rc_work.right - rc_work.left) * 80 / 100;
		const unsigned cy = (rc_work.bottom - rc_work.top) * 80 / 100;

		unsigned left = (rc_work.right - rc_work.left - cx) / 2;
		unsigned top = (rc_work.bottom - rc_work.top - cy) / 2;

		if (main_window::config_get_is_first_run())
		{
			cfg_plist_width = cx * 10 / 100;
		}
		else if (!g_colours_fonts_imported)
		{
			g_import_pv_colours_to_unified_global();
			g_import_fonts_to_unified();
		}

		g_colours_fonts_imported = true;

		g_main_window = CreateWindowEx(main_window::config_get_transparency_enabled() ? WS_EX_LAYERED : 0 /*WS_EX_TOOLWINDOW*/, main_window_class_name, _T("foobar2000"), WS_OVERLAPPED | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
			WS_THICKFRAME, left, top, cx, cy, 0, 0, core_api::get_my_instance(), NULL);

		main_window::on_transparency_enabled_change();

		bool rem_pos = remember_window_pos();

		if (rem_pos && !main_window::config_get_is_first_run())
		{
			SetWindowPlacement(g_main_window, &cfg_window_placement_columns.get_value());
			size_windows();
			ShowWindow(g_main_window, cfg_window_placement_columns.get_value().showCmd);

			if (g_icon_created && (cfg_window_placement_columns.get_value().showCmd == SW_SHOWMINIMIZED) && cfg_minimise_to_tray)
				ShowWindow(g_main_window, SW_HIDE);
		}
		else
		{
			size_windows();
			ShowWindow(g_main_window, SW_SHOWNORMAL);
		}

		if (g_rebar) ShowWindow(g_rebar, SW_SHOWNORMAL);
		if (g_status) ShowWindow(g_status, SW_SHOWNORMAL);
		if (g_status_pane.get_wnd()) ShowWindow(g_status_pane.get_wnd(), SW_SHOWNORMAL);
		g_layout_window.show_window();

		RedrawWindow(g_main_window, 0, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);

		if (main_window::config_get_is_first_run())
			SendMessage(g_main_window, MSG_RUN_INITIAL_SETUP, NULL, NULL);

		main_window::config_set_is_first_run();

		return g_main_window;
	}