/*! ファイルタブを選択した・ファイルコア函数 @param[in] uqNumber 選択されたファイルのUNIQUE番号 @return HRESULT 終了状態コード */ HRESULT DocMultiFileSelect( LPARAM uqNumber ) { FILES_ITR itNow; POINT stCaret; for( itNow = gltMultiFiles.begin(); itNow != gltMultiFiles.end(); itNow++ ) { if( uqNumber == itNow->dUnique ) break; } if( itNow == gltMultiFiles.end() ) return E_OUTOFMEMORY; ViewSelPageAll( -1 ); // 今開いてる頁の範囲選択を破棄 PageListClear( ); // ページリストビューも破棄 gitFileIt = itNow; // ファイルなう // TODO: 初回読み込み時のバイト数計算間違えてるようだ・なおった? PageListBuild( NULL ); // ページリスト作り直し AppTitleChange( itNow->atFileName ); // キャプションの内容も変更 gixFocusPage = itNow->dNowPage; DocModifyContent( itNow->dModify ); // 変更したかどうか DocCaretPosMemory( INIT_LOAD, &stCaret ); // 先に読み出さないと次でクルヤーされる PageListViewChange( gixFocusPage, -1 ); // 全部読み込んだのでラストページを表示する ViewPosResetCaret( stCaret.x, stCaret.y ); // Caret位置再設定 return S_OK; }
/*! 内容を書き込む @param[in] hWnd ウインドウハンドル・あまり意味はない @return HRESULT 終了状態コード */ HRESULT VertScriptInsert( HWND hWnd ) { LPTSTR ptText; INT iTgtRow, iMaxRow, iMaxClm; INT iRitDot, iNeedPadd; HWND hLyrWnd; INT iX, iY; RECT rect; wstring wsBuffer; // 作った文字列を入れちゃう VTIM_ITR itVtitm; VTIM_RITR itRvsVtitm; //右からなら逆にたどる。左からなら正順。Rowを基準値にして、直前位置とのスキマは空白埋め //改行とか入れまくって一繋がりの文字列にして、ステルスレイヤで貼る。 // 縦横の大きさを求める iMaxRow = 0; iMaxClm = 0; for( itVtitm = gvcVertItem.begin(); itVtitm != gvcVertItem.end(); itVtitm++ ) { if( iMaxRow < itVtitm->iRow ) iMaxRow = itVtitm->iRow; if( iMaxClm < itVtitm->iColumn ) iMaxClm = itVtitm->iColumn; } ptText = NULL; wsBuffer.clear(); for( iTgtRow = 0; iMaxRow >= iTgtRow; iTgtRow++ ) // 文字位置を上から順番に見ていく { iRitDot = 0; if( gbLeftGo ) // 左から { for( itVtitm = gvcVertItem.begin(); itVtitm != gvcVertItem.end(); itVtitm++ ) { if( iTgtRow == itVtitm->iRow ) // 注目ROWが一致したら { iNeedPadd = itVtitm->iOffset - iRitDot; // ここまでの右端からのドット数 if( 0 > iNeedPadd ) { iNeedPadd = 0; // 重なった場合とかあり得る } ptText = DocPaddingSpaceMake( iNeedPadd ); // 0ならNULLが返る if( ptText ) // 埋め分を継ぎ足す { wsBuffer += wstring( ptText ); FREE( ptText ); } wsBuffer += itVtitm->cch; // 本命の文字を入れる iRitDot += iNeedPadd; // ここまでの埋め量と iRitDot += itVtitm->iWidth; // 使用幅を埋める } } } else { // 右から for( itRvsVtitm = gvcVertItem.rbegin(); itRvsVtitm != gvcVertItem.rend(); itRvsVtitm++ ) { if( iTgtRow == itRvsVtitm->iRow ) // 注目ROWが一致したら { iNeedPadd = itRvsVtitm->iOffset - iRitDot; // ここまでの右端からのドット数 if( 0 > iNeedPadd ) { iNeedPadd = 0; // 重なった場合とかあり得る } ptText = DocPaddingSpaceMake( iNeedPadd ); // 0ならNULLが返る if( ptText ) // 埋め分を継ぎ足す { wsBuffer += wstring( ptText ); FREE( ptText ); } wsBuffer += itRvsVtitm->cch; // 本命の文字を入れる iRitDot += iNeedPadd; // ここまでの埋め量と iRitDot += itRvsVtitm->iWidth; // 使用幅を埋める } } } wsBuffer += wstring( CH_CRLFW ); // 壱行終わったら改行 } // 挿入処理には、レイヤボックスを非表示処理で使う hLyrWnd = LayerBoxVisibalise( GetModuleHandle(NULL), wsBuffer.c_str(), 0x10 ); // レイヤの位置を変更 GetWindowRect( ghVertViewWnd, &rect ); LayerBoxPositionChange( hLyrWnd, (rect.left + gstFrmSz.x), (rect.top + gstFrmSz.y) ); // 設定によれば、空白を全部透過指定にする if( gbSpTrans ) { LayerTransparentToggle( hLyrWnd, 1 ); } // 上書きする LayerContentsImportable( hLyrWnd, IDM_LYB_OVERRIDE, &iX, &iY, D_INVISI ); ViewPosResetCaret( iX, iY ); // 終わったら閉じる DestroyWindow( hLyrWnd ); return S_OK; }