int main(int argc, char *argv[]) { try { QApplication app(argc, argv); app.setOrganizationName(ORG_NAME); app.setApplicationName(APP_NAME); int mainRows, mainCols, subRows, subCols; { QSettings settings(app.organizationName(), app.applicationName()); settings.beginGroup("grid"); mainRows = settings.value("mainRows", VIDEO_MAIN_ROWS).toInt(); mainCols = settings.value("mainCols", VIDEO_MAIN_COLS).toInt(); subRows = settings.value( "subRows", VIDEO_SUB_ROWS ).toInt(); subCols = settings.value( "subCols", VIDEO_SUB_ROWS ).toInt(); settings.endGroup(); } Frontend* win = new Frontend(mainRows, mainCols, subRows, subCols); // calculator.Run(); win->start(); app.exec(); delete win; DT("Frontend exit from main"); app.exit(0); } catch (EX e) { DT("Frontend exception (%s)", e.what()); } return 0; }
// THE signal handler static void _dbgSigHandler(int sig) { DT("Debug: signal #%d (%s) catched", sig, strsignal(sig)); switch(sig) { // all signals to trace are "cased" here case SIGABRT: case SIGSEGV: case SIGBUS : case SIGILL : case SIGFPE : DBG_BTRACE2(2, false); // in release mode no dump occurs break; default: //DBG_BTRACE(2, false); // uncomment just for testing backtrace dump on all signals break; } //DT("looking for prev sig handler"); SigMap::const_iterator is = _sigMap.find(sig); if(is != _sigMap.end()) { //DT("prev sig handler found"); sighandler_t h = is->second; if(h && h!=SIG_ERR) { h(sig); // exec previously defined signal handler DT("prev sig handler executed"); } } //DT("shutdown..."); _dbgSigShutdown(sig); //DT("shutdown DONE"); exit(sig); //DT("exit!!!!"); }
static int sort_elem(t_list **alst) { t_list *t[3] = {*alst, (*alst)->next, *alst}; if (DT(*(((T_FP *)(t[0]->CT))->td), *(((T_FP *)(t[1]->CT))->td)) < 0) { t[0]->next = t[1]->next; t[1]->next = t[0]; *alst = t[1]; } t[0] = t[1]; t[1] = t[1]->next; while (t[1]) { if (DT(*(((T_FP *)(t[0]->CT))->td), *(((T_FP *)(t[1]->CT))->td)) < 0) { t[0]->next = t[1]->next; t[1]->next = t[0]; t[2]->next = t[1]; return (1); } t[2] = t[0]; t[0] = t[1]; t[1] = t[1]->next; } return (0); }
AnyTensor AnyTensor::vertcat(const std::vector<AnyScalar>& v) { switch (AnyScalar::type(v)) { case TENSOR_DOUBLE: return DT(AnyScalar::as_double(v), {static_cast<int>(v.size())}); case TENSOR_SX: return ST(SX::vertcat(AnyScalar::as_SX(v)), {static_cast<int>(v.size())}); case TENSOR_MX: return MT(MX::vertcat(AnyScalar::as_MX(v)), {static_cast<int>(v.size())}); default: tensor_assert(false); return DT(); } }
CFrame* CFrameTable::Create(CComPtr<IHTMLDocument2> document) { DT(TRACE_I(FS(_T("C_FrameTable::Create(doc=%08X)"), document))); if (GetFrameId(document)!=NULL_FRAME) return Find(document); CFrame* pkFrame = new CFrame(document, *this); // !!! don't dispatch mesages here CFrame* res = Insert(pkFrame); ATLASSERT(res); if (!res) delete pkFrame; DT(Dump()); // ok free to dispatch messages return res; }
STDMETHODIMP CUpgradrScriptDebugger::OnConnectDebugger(IApplicationDebugger __RPC_FAR *pad) { Sleep(0); DT(TRACE_W("CUpgradrScriptDebugger::OnConnectDebugger()")); return S_OK; }
STDMETHODIMP CUpgradrScriptDebugger::OnDebugOutput(LPCOLESTR pstr) { Sleep(0); DT(TRACE_W(FS(_T("CUpgradrScriptDebugger::OnDebugOutput(%S)"), pstr))); return S_OK; }
STDMETHODIMP CUpgradrScriptDebugger::OnClose() { Sleep(0); DT(TRACE_W("CUpgradrScriptDebugger::OnClose()")); return S_OK; }
STDMETHODIMP CUpgradrScriptDebugger::OnLeaveBreakPoint(IRemoteDebugApplicationThread __RPC_FAR *prdat) { Sleep(0); DT(TRACE_W("CUpgradrScriptDebugger::OnLeaveBreakPoint()")); return S_OK; }
STDMETHODIMP CUpgradrHelperbar::GetWindow(HWND *phwnd) { DT(TRACE_I(FS(_T("Helperbar[%08X]: GetWindow(%08X)"), this, phwnd))); *phwnd = m_MainWindow; return S_OK; }
STDMETHODIMP CXRefreshToolbar::GetWindow(HWND *phwnd) { DT(TRACE_I(FS(_T("Toolbar[%08X]: GetWindow(%08X)"), this, phwnd))); *phwnd = m_Toolbar; return S_OK; }
// CUpgradrToolbar CUpgradrToolbar::CUpgradrToolbar(): m_kToolbar(TOOLBARCLASSNAME, this, ALT_MAP_TB_TOOLBAR), m_dwBandId(0), m_dwViewMode(0), m_iToolbarHeight(22) { DT(TRACE_I(FS(_T("Toolbar[%08X]: constructor"), this))); CBitmap toolbar; CBitmap mask; m_kAccelerator.LoadAccelerators(MAKEINTRESOURCE(IDR_ACCELERATOR1)); if (m_kAccelerator.IsNull()) throw CUpgradrWindowsError(GetLastError()); toolbar.LoadBitmap(MAKEINTRESOURCE(IDB_TOOLBAR)); if (toolbar.IsNull()) throw CUpgradrWindowsError(GetLastError()); mask.LoadBitmap(MAKEINTRESOURCE(IDB_TOOLBARMASK)); if (mask.IsNull()) throw CUpgradrWindowsError(GetLastError()); CDPIHelper::ScaleBitmap(toolbar); CDPIHelper::ScaleBitmap(mask); int width = (int)CDPIHelper::ScaleX(16); int height = (int)CDPIHelper::ScaleY(16); m_kImageList.Create(width, height, ILC_COLOR24 | ILC_MASK, 3, 3); if (m_kImageList.IsNull()) throw CUpgradrWindowsError(GetLastError()); if (m_kImageList.Add(toolbar, mask) == -1) throw CUpgradrWindowsError(GetLastError()); }
STDMETHODIMP CUpgradrToolbar::SetSite(IUnknown *pUnknownSite) { DT(TRACE_I(FS(_T("Toolbar[%08X]: SetSite(%08X)"), this, pUnknownSite))); try { if (!!pUnknownSite) { // attach the window HWND hMyWindow; CComPtr<IUnknown> site(pUnknownSite); CComQIPtr<IOleWindow> window(site); window->GetWindow(&hMyWindow); if (!hMyWindow) { TRACE_E(FS(_T("Toolbar[%08X]: Cannot retrieve toolbar base window"), this)); return E_FAIL; } SubclassWindow(hMyWindow); // get a WebBrowser reference CComQIPtr<IServiceProvider> serviceProvider(site); serviceProvider->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&m_spWebBrowser); site->QueryInterface(IID_IInputObjectSite, (void**)&m_spSite); // create main window CreateMainWindow(); } } catch (CUpgradrRuntimeError &ex) { HandleError(ex.ErrorMessage()); return E_FAIL; } return S_OK; }
STDMETHODIMP CUpgradrScriptDebugger::OnSetName(LPCOLESTR pstrName) { Sleep(0); DT(TRACE_W(FS(_T("CUpgradrScriptDebugger::OnSetName(%S)"), pstrName))); return S_OK; }
STDMETHODIMP CUpgradrScriptDebugger::OnDisconnectDebugger() { Sleep(0); DT(TRACE_W("CUpgradrScriptDebugger::OnDisconnectDebugger()")); return S_OK; }
LRESULT CUpgradrToolbar::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // Notify IE of the focus change DT(TRACE_I(FS(_T("Toolbar[%08X]: Focus gained"), this))); m_spSite->OnFocusChangeIS(static_cast<IDockingWindow*>(this), TRUE); return S_OK; }
AnyTensor AnyTensor::pack(const std::vector<AnyTensor>& v, int axis) { switch (AnyTensor::type(v)) { case TENSOR_DOUBLE: return DT::pack(AnyTensor::as_DT(v), axis); case TENSOR_SX: return ST::pack(AnyTensor::as_ST(v), axis); case TENSOR_MX: return MT::pack(AnyTensor::as_MT(v), axis); default: tensor_assert(false); return DT(); } }
STDMETHODIMP CXRefreshToolbar::CloseDW(DWORD dwReserved) { DT(TRACE_I(FS(_T("Toolbar[%08X]: CloseDW(%08X)"), this, dwReserved))); ShowDW(FALSE); // CloseDW purposely does not destroy the window. We leave that to the destructor. return S_OK; }
STDMETHODIMP CXRefreshToolbar::GetSite(const IID &riid, void **ppvSite) { DT(TRACE_I(FS(_T("Toolbar[%08X]: GetSite(...)"), this))); if (!ppvSite) return E_INVALIDARG; *ppvSite = NULL; return m_Site->QueryInterface(riid, ppvSite); }
STDMETHODIMP CXRefreshToolbar::ShowDW(BOOL fShow) { DT(TRACE_I(FS(_T("Toolbar[%08X]: ShowDW(%s)"), this, fShow?_T("TRUE"):_T("FALSE")))); if (!m_Toolbar) return E_FAIL; m_Toolbar.ShowWindow(fShow ? SW_SHOW : SW_HIDE); return S_OK; }
LRESULT CXRefreshToolbar::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // notify IE of the focus change DT(TRACE_I(FS(_T("Toolbar[%08X]: Focus lost"), this))); m_Site->OnFocusChangeIS(static_cast<IDockingWindow*>(this), FALSE); return S_OK; }
STDMETHODIMP CXRefreshToolbar::GetBandInfo(DWORD dwBandId, DWORD dwViewMode, DESKBANDINFO *pdbi) { DT(TRACE_I(FS(_T("Toolbar[%08X]: GetBandInfo(...)"), this))); try { if( pdbi == NULL ) return E_INVALIDARG; m_dwBandId = dwBandId; m_dwViewMode = dwViewMode; if( pdbi->dwMask & DBIM_MINSIZE ) { pdbi->ptMinSize = GetMinSize(); } if( pdbi->dwMask & DBIM_MAXSIZE ) { pdbi->ptMaxSize = GetMaxSize(); } if( pdbi->dwMask & DBIM_INTEGRAL ) { pdbi->ptIntegral.x = 1; pdbi->ptIntegral.y = 1; } if( pdbi->dwMask & DBIM_ACTUAL ) { pdbi->ptActual = GetActualSize(); } if( pdbi->dwMask & DBIM_TITLE ) { wcscpy_s(pdbi->wszTitle, GetTitle()); } if( pdbi->dwMask & DBIM_MODEFLAGS ) { pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_USECHEVRON; } if( pdbi->dwMask & DBIM_BKCOLOR ) { // use the default background color by removing this flag pdbi->dwMask &= ~DBIM_BKCOLOR; } return S_OK; } catch (CXRefreshRuntimeError &ex) { HandleError(ex.ErrorMessage()); return E_FAIL; } }
STDMETHODIMP CUpgradrHelperbar::GetClassID(LPCLSID pClassId) { DT(TRACE_I(FS(_T("Helperbar[%08X]: GetClassID()"), this))); if (!pClassId) return E_INVALIDARG; *pClassId = CLSID_UpgradrHelperbar; return S_OK; }
CXRefreshBHO::CXRefreshBHO(): m_BrowserId(NULL_BROWSER), m_Logger(NULL_BROWSER), m_ConnectionManager(this), m_Paused(false) { InitRoot(); DT(TRACE_I(FS(_T("BHO[%08X]: constructor"), this))); }
STDMETHODIMP CUpgradrScriptDebugger::OnBreakFlagChange(APPBREAKFLAGS abf, IRemoteDebugApplicationThread __RPC_FAR *prdatSteppingThread) { Sleep(0); DT(TRACE_W(FS(_T("CUpgradrScriptDebugger::OnBreakFlagChange(%ld)"), abf))); ScriptDebuggerLock scriptDebugger; scriptDebugger->m_DebugFlags = abf; return S_OK; }
/****************************二值化******************************/ void erzhi(void) { uint8_t i; DT(); for(i = 0;i <= 128;i++) { if(Pixel[i] > AverageValue) Pixel[i] = 255; else Pixel[i] = 0; } }
STDMETHODIMP CUpgradrToolbar::ShowDW(BOOL fShow) { DT(TRACE_I(FS(_T("Toolbar[%08X]: ShowDW(%s)"), this, fShow?_T("TRUE"):_T("FALSE")))); if (m_kToolbar) { ShowWindow(fShow ? SW_SHOW : SW_HIDE); } return S_OK; }
// CUpgradrHelperbar CUpgradrHelperbar::CUpgradrHelperbar(): m_BandId(0), m_ViewMode(0), m_BrowserId(NULL_BROWSER), m_Toolbar(TOOLBARCLASSNAME, this, ALT_MAP_HELPERBAR_TOOLBAR), m_UnpinButtonIndex(-1) { InitRoot(); DT(TRACE_I(FS(_T("Helperbar[%08X]: constructor"), this))); }
///диспетчер выполнения процесса определения масштаба страницы. float GMainEditor::setScaleOCR(GBitmap *pechaImg_){ //cout<<"Start#1 "<<inputData.data["inputFile"]<<endl; if(!pechaImg_){cout_<<"no open file"<<inputData.data["inputFile"]<<endl; return 1;} pechaImg=pechaImg_; float pageScale=1; int border; string str; int print=0; DT("@4_1"); //vectorBase[0].allVectorCount=0; border=0; if(!strArray.size()){ setBit=GBitset::createResize(pechaImg_,1,1,1); DT("@4_2"); setBit->pageStringDetector(strArray,1); // Подпрограмма выделения строк и букв ПЕЧА ( РЕЛЬСЫ ) DT("@4_3"); border=setBit->border_size(); DT("@4_4"); setOCR=GBitsetOCR::createResize(pechaImg_,1,1); //if(NewLetterOnlyBtn->Checked==true) {mode=NEWLETTERINBOOK;}else{mode=ALL_LETTER;} str=fileName(inputData.data["inputFile"]); DT("@@@ file="<<str); setOCR->setData( aliKali, strArray, correctionTable, logicProcessor, iLeft, iTop, border, OCR_NORMALISATION); } //fontEditor->setLanguage(); pageScale=setOCR->setScaleOCR(logicProcessor, OCR_NORMALISATION); return pageScale; //cout<<"done "<<inputData.data["inputFile"]<<endl; }//________________________________________________________________________________________________________________
/****************************二值化******************************/ void erzhi(void) { uint8_t i; // unsigned char AverageValue; DT(); for(i=0;i<127;i++) { if(Pixel[i]>AverageValue) Pixel[i] = 255; else Pixel[i] = 0; } }