Kenji KOBAYASHI
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # EEIC 後期実験 大規模ソフトウェア チーム12 進捗報告 ## Day 1(10/06) 今回は、チームを結成し作成するプロダクトの方針を決めた。 ソフトウェア: Libre Office Writer 目標:[去年の班](https://qiita.com/kakekakemiya/items/305123135d09f9e80a4d)を参考に、Libre Office WriterのUndo機能をいじる。 進捗:Githubで苦戦。 ## Day 2(10/11) 目標:ビルドとGithubにアップ わかったこと整理: Writerのコードはcore/swフォルダにある。 Undo機能をいじるのはここをいじることになる。 core/sw/source/core/incにUndoManager.hxxがあって、 ・core/sw/source/core/doc ・core/sw/source/core/undo あたりが怪しそう。どうせデバッグする。 困ったこと [公式?のサイト](https://wiki.documentfoundation.org/Development/BuildingOnLinux#Cloning_and_building)に従ってビルドしようとしたが、./autogen.shの部分で ``` configure: error: Package requirements (fontconfig >= 2.4.1) were not met: No package 'fontconfig' found ``` というエラーが出てしまい、詰まる。 ->始めのパッケージをインストールするところで完全にはインストールができていないことが原因だった。apt search fontconfigから未インストールだった〇〇-devをインストール、その後始めのインストール文の塊を再度実行したところ、解決した。 ## Day3(10/13) ・ビルドした ・デバッガで動作することを確認した。 ・githubにソースファイルをプッシュしようとしたがエラーが出た。 <details> <summary> ビルド手順 </summary> ``` $ CFLAGS="-O0 -g" ./autogen.sh --enable-dbgutil $ make -j 8 $ make check ``` launch.jsonのファイルを以下のように指定する。 ``` { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot}/instdir/program/soffice.bin", "args": ["--writer"], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": true, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] } ``` 実行する。 </details> <details> <summary> Githubのエラー①:gerrit経由のソースコード取得 </summary> 公式サイトのビルド手順に従って、以下のようにローカルにクローンをした。 ``` $ git clone https://gerrit.libreoffice.org/core libreoffice ``` これをgithubのレポジトリにpushしようとした際、以下のようなエラーが出た。 ``` $ git push -u origin master Enumerating objects: 5092704, done. Counting objects: 100% (5092704/5092704), done. Delta compression using up to 8 threads Compressing objects: 100% (901227/901227), done. remote: error: object 086ff12951769a2fadfc0f92f57c2e4f41108b72: missingSpaceBeforeEmail: invalid author/committer line - missing space before email remote: fatal: fsck error in packed object error: remote unpack failed: index-pack abnormal exit To github.com:doss-eeic/2022-12-LibreOffice ! [remote rejected] master -> master (failed) error: failed to push some refs to 'git@github.com:doss-eeic/2022-12-LibreOffice' ``` 試したこと: 1. Github自体にメールアドレスを登録していなかった可能性もあったため、登録を確認したが、登録されていた。再度登録したあとも、同じエラーが出力された。 2. git/hooksによって弾かれている可能性もあったため、 ``` $ git push -u origin master --no-verify ``` を実行してhooksを無視するように試みたが、同じエラーが出力された。 3. エラーメッセージを再度しっかり読み、[同じエラー](https://stackoverflow.com/questions/21971941/invalid-author-committer-line-missing-space-before-email)を見つけたため、その解決方法に従った。 まず、 ``` denjo@DJ00001:~/libreoffice$ git cat-file -p 086ff12951769a2fadfc0f92f57c2e4f41108b72 tree d323b72ff9d06bb1d4afe338d0afff87868c1e51 parent c8ba0c921140c1afc84cc2703ed229f6fba4f7d9 parent fa27b2da2f8e7bd9bafb4a057318ac22577727dd author Andre Fischer<andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com>> 1296036671 +0100 committer Andre Fischer<andre.f.fischer <Andre Fischer<andre.f.fischer@oracle.com>> 1296036671 +0100 impress195: rebase to DEV300 ``` によって、問題のcommitファイル(commit番号086ff12951769a2fadfc0f92f57c2e4f41108b72)の中身を見た。結果、メッセージが指摘する通り、メールアドレスと名前の間にスペースがなかったことがわかった。 よって、これを解決するために、[これ](https://stackoverflow.com/questions/3042437/how-to-change-the-commit-author-for-a-single-commit?lq=1)の2番めの回答に従ってコードを実行した。 ``` denjo@DJ00001:~/libreoffice$ git checkout 086ff12951769a2fadfc0f92f57c2e4f41108b72 ``` を実行してまず問題のcommitファイルにアクセスし、 ``` Updating files: 100% (133985/133985), done. Note: switching to '086ff12951769a2fadfc0f92f57c2e4f41108b72'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c <new-branch-name> Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 086ff1295176 impress195: rebase to DEV300 m98 ``` 以下のコマンドでcommitファイルに編集を加えた。ここで、名前とメールアドレスを更新した。 ``` denjo@DJ00001:~/libreoffice$ git commit --amend --author "Kenji Kobayashi <kenji.kobayashi0419@gmail.com>" [detached HEAD 74a6c21bd334] impress195: rebase to DEV300 m98 Author: Kenji Kobayashi <kenji.kobayashi0419@gmail.com> Date: Wed Jan 26 11:11:11 2011 +0100 ``` そしてもともとのmasterに戻り、問題のあるコミットを塗り替えた。 ``` denjo@DJ00001:~/libreoffice$ git checkout master Updating files: 100% (133985/133985), done. Warning: you are leaving 1 commit behind, not connected to any of your branches: 74a6c21bd334 impress195: rebase to DEV300 m98 If you want to keep it by creating a new branch, this may be a good time to do so with: git branch <new-branch-name> 74a6c21bd334 Switched to branch 'master' Your branch is up to date with 'upstream/master'. denjo@DJ00001:~/libreoffice$ git replace 086ff12951769a2fadfc0f92f57c2e4f41108b72 086ff1295176 ``` ここで最後に、問題のあったcommit以降のcommitをまた戻すコマンドを実行したところ、 ``` denjo@DJ00001:~/libreoffice$ git filter-branch -- --all WARNING: git-filter-branch has a glut of gotchas generating mangled history rewrites. Hit Ctrl-C before proceeding to abort, then use an alternative filtering tool such as 'git filter-repo' (https://github.com/newren/git-filter-repo/) instead. See the filter-branch manual page for more details; to squelch this warning, set FILTER_BRANCH_SQUELCH_WARNING=1. Proceeding with filter-branch... fatal: replace depth too high for object 086ff12951769a2fadfc0f92f57c2e4f41108b72 ``` 上記のようにcommitの数が多すぎるため、戻すことができないと出力された。そこで問題のcommitがいつのものであったのかをかくにんしたところ、 ``` Date: Wed Jan 26 11:11:11 2011 +0100 ``` のcommitであるとわかった。これを見て、この方法での解決を断念した。 </details> <details> <summary> Githubのエラー②:Github経由のソースコード取得 </summary> ①ではgerritからソースコードを入手したのが問題であったと考え、今回はGithubに載っているソースコードをローカルにとってきて、それをpushしようと考えた。しかし、同じエラーが出て、できなかった。 ``` denjo@DJ00001:~/lectures/largesoft/core$ git remote -v origin git@github.com:doss-eeic/2022-12-LibreOfficeWriter.git (fetch) origin git@github.com:doss-eeic/2022-12-LibreOfficeWriter.git (push) upstream https://github.com/LibreOffice/core.git (fetch) upstream https://github.com/LibreOffice/core.git (push) denjo@DJ00001:~/lectures/largesoft/core$ git rename upstream git: 'rename' はgitコマンドではありません。 'git --help'を参照してください。 The most similar command is rebase denjo@DJ00001:~/lectures/largesoft/core$ git push -u origin master Enumerating objects: 5089050, done. Counting objects: 100% (5089050/5089050), done. Delta compression using up to 8 threads Compressing objects: 100% (1041312/1041312), done. remote: error: object 086ff12951769a2fadfc0f92f57c2e4f41108b72: missingSpaceBeforeEmail: invalid author/committer line - missing space before email remote: fatal: fsck error in packed object error: remote unpack failed: index-pack abnormal exit To github.com:doss-eeic/2022-12-LibreOfficeWriter.git ! [remote rejected] master -> master (failed) error: failed to push some refs to 'git@github.com:doss-eeic/2022-12-LibreOfficeWriter.git' ``` </details> <details> <summary> Githubエラーの➂:tarファイルをダウンロードしてやり直した->失敗 </summary> --- ここからやり直し後 1. [ダウンロードサイト](https://ja.libreoffice.org/download/download/)からLibreOffice 7.4.2をダウンロードした。 2. tarファイルを展開した。 `tar xvf LibreOffice_7.4.1_Linux_x86-64_deb.tar.gz` 3. 必要なパッケージをダンロードするために `sudo apt-get build-dep libreoffice` を行ったが、 `E: You must put some 'deb-src' URIs in your sources.list` というエラーが出たので、[このサイト](https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list)をもとに `software-properties-gtk` を打ち込み、この画面でソースコードの項目にチェックを入れた。 ![](https://i.imgur.com/shlr3sC.png) もう一度試すと下のエラーが出た。 `依存関係ツリーを作成しています 状態情報を読み取っています... 完了 インストールすることができないパッケージがありました。おそらく、あり得 ない状況を要求したか、(不安定版ディストリビューションを使用しているの であれば) 必要なパッケージがまだ作成されていなかったり Incoming から移 動されていないことが考えられます。 以下の情報がこの問題を解決するために役立つかもしれません: 以下のパッケージには満たせない依存関係があります: builddeps:libreoffice : 競合: fonts-opensymbol しかし、2:102.11+LibO6.4.7-0ubuntu0.20.04.5 はインストールされようとしています E: 問題を解決することができません。壊れた変更禁止パッケージがあります。 ` 4.[この記事](https://wiki.documentfoundation.org/Development/Linux_Build_Dependencies/ja)に従って下のコマンドを入力 `sudo apt-get install git ccache junit4 gstreamer1.0-libav libkrb5-dev nasm graphviz libpython3-dev` ->問題は解決せず </details> <details> <summary> Githubエラーの解決策 </summary> ``` $ git clone https://gerrit.libreoffice.org/core libreoffice ``` と、githubからではないところから持ってきていたため、問題が起きてしまっていたと考えた。したがって、直接githubのレポジトリをforkしたところ、問題は起きず、解決した。 </details> ## Day4(10/17) ・関係ありそうなところにブレイクポイントを打ちながらデバッグで動きを追跡しようとしたが、各関数が複雑に絡み合っているため苦戦。大事そうな箇所をとりあえず一回まとめて全体像を見ようとした。 大事そうな箇所 ・SwDocクラスの定義 sw/core/source/doc/docnew.cxxの201 ・DeleteRedLine(メソッド) sw/core/source/doc/DocumentRedlineManager.cxxの2550 ・AppendRedLine(メソッド) sw/core/source/doc/DocumentRedlineManager.cxxの1256 ・SwNodes(クラス) sw/core/source/docnode/nodes.cxxの60 ・swundo.hxx(これがIDocumentUndoRedo.hxxのおおもと、ここでSwUndoIdの内容を定義している) sw/inc/swundo.hxx ・IDocumentUndoRedo.hxx sw/inc/IDocumentUndoRedo.hxx IDocumentUndoRedoクラス(UnDoをする際に使う関数をまとめたもの)を定義している。 ・UndoManager.hxx sw/source/core/inc/UndoManager.hxx 名前空間sw::の中身が定義されている。あと各関数のアクセス制御(publicとprivate)が定義されている。 ・ツールバーでのundoボタン(sw/uiconfic/swriter/toolbar/standardbar.xml) ``` <toolbar:toolbaritem xlink:href=".uno:Undo"/> <toolbar:toolbaritem xlink:href=".uno:Redo"/> ``` 使われていそうな場所 sw/qa/extras/uiwriter/uiwriter2.cxx: dispatchCommand(mxComponent, ".uno:Redo", {}) ・文字列の入力はここから始まる sw/source/core/doc/DocumentContentOperationsManager.cxxの2820 ・入力関係のおおもと sw/source/core/doc/DocumentContentOperationsManager.cxxの1977 今後の方針: ・sw/source/core/doc/DocumentContentOperationsManager.cxxの2820(文字列入力を扱うところ)にブレイクポイントを打ち毎入力の動作を追跡する。 ・その際に、c++のポインタ周りの知識が不足しているため[ここ](https://learn.microsoft.com/ja-jp/cpp/cpp/cpp-language-reference?view=msvc-170)や[ここ](https://rinatz.github.io/cpp-book/ch06-05-smart-pointers/)を見てしらべていく。 ## Day5 わかったこと <details> <summary> 全体のコード構成について </summary> 変数やクラス名においては[Hungarian Notation](https://www.cse.iitk.ac.in/users/dsrkg/cs245/html/Guide.html)が使われていて、 * pがポインタ * bがブーリアン * m_はクラスのメンバー * nはinteger * aがarray * eはend その他に、クラス名にrはラン?、mは行列? </details> <details> <summary> Undo操作全体について </summary> Undo動作はおそらく、 ``` SwBaseShell::ExceUndo→SwWrtShell::Do→SwEditShell::Undo→UndoManager::UndoWithOffset→UndoManager::impl_DoUndoRedo ``` のような階層で行われている。 ここのうちSwEditShell::UndoとUndoManager::impl_DoUndoRedで大事な実装が行われているように見える。特にUndoの方。 以下に各クラスに対するPATHを残しておく。 ``` SwBaseShell::ExceUndoはsw/source/uibase/shells/basesh.cxxのおよそ600 SwWrtShell::Doはsw/source/uibase/wrtsh/wrtundo.cxxのおよそ34 SwEditShell::Undoはsw/source/core/edit/edundo.cxxのおよそ105 UndoManager::UndoWithOffsetはsw/source/core/undo/docundo.cxxのおよそ726 UndoManager::impl_DoUndoRedはsw/source/core/undo/docundo.cxxのおよそ665 ``` </details> <details> <summary> SwBaseShell::ExecUndoの動作について。 </summary> nIdの値でUndo,Redo,Repeatを区別している。5701はUndo nId自体はrReqクラスのGetSlotメソッドで手に入れている→GetSlotメソッドの時点で入力が区別ついていることになる。 このnIdで動作を区別して、実際のUndoの動作はrWrtShell::Doを呼び出してさせている。 rWrtShell::DoにもUndoであることを認識させるために第一引数にUNDOを入れている。 </details> <details> <summary> SwWrtShell::Doの動作について。 </summary> eDoTypeが引数で渡されたUNDOになり、それによって動作をRedoとRepeatから区別する。 そしてSwEditShell::Undoメソッドが実行される。ここでもうUndoの中身は終わっているのでは 返ってきたあともいろいろとやっている。ここは詳しく見ていく必要あり。 </details> <details> <summary> SwEditShell::Undoの動作について。 </summary> ここでいろいろと実行しているっぽいから詳細に見ていく必要あり。 </details> <details> <summary> UndoManager::UndoWithOffsetの動作について。 </summary> 動作も何も、UndoManager::impl_DoUndoRedに動作を投げ渡しているだけ。 </details> <details> <summary> UndoManager::impl_DoUndoRedの動作について。 </summary> なにやっているのかよくわからない。ここも詳しく見ていく必要あり。 </details> Main関数 desktop/source/app/app.cxx l1243 作業の方針 ・aのあとにcommand+Zを入力としてundoをしたときどの時点で画面に反映されているかを調べる ブレークポイント:vcl/source/window/winproc.cxx 1211行 ->入力待機のスレッドだと判断した。 ブレークポイント2: UndoManager系の関数 ここを探っていけばわかるかも(10/18授業終了時点) ## 参考になりそうな資料 モジュールとかの管理?というか説明。 https://docs.libreoffice.org/ issue関連 https://ask.libreoffice.org/tags/c/english/5/writer 関数検索 https://opengrok.libreoffice.org/search?project=core&full=main&defs=&refs=&path=&hist=&type=&xrd=&nn=1&si=full&si=full SwDocの中のクラスの関係図 https://docs.libreoffice.org/sw/html/classSwDoc.html ただのメモ ・[DeleteStackという大事そうな単語](https://docs.libreoffice.org/sw/html/classSwCursorShell.html)けどUndoでは反応せず。 > sw/source/filter/ww8/ww8par.hxx: void DeleteStack(std::unique_ptr<SwFltControlStack> prStck); > ・bool SwWrtShell::DelLeft()でこれはbackspaceに反応した!!! > sw/source/uibase/wrtsh/delete.cxx ・疑問:Cursorってなに。Cursorは素直にマウスのカーソルな感じがするな。 ・sw/source/core/edit/edws.cxxの200あたり。 →Undo関連の大事な関数たちが定義されている→ここにブレークポイント ・sw/inc/IDocumentUndoRedo.hxxの関数定義で大事なところがいっぱいあるから読む。ここをちょっと見る感じnUndoIdでundoにそれぞれIDをつけ、pRewriterでrewriteさせている。 ・Stackをgrepで検索したらUndo Stackというものがあるっぽい。あとpChildとかpNextとかはなにかのStackへのポインタ。 ただのメモ2 ・UNOという単語が出てくるのでその参考になるかも  https://api.libreoffice.org/ ・C++のクラス内のメンバ関数について([文法](https://rinatz.github.io/cpp-book/ch07-02-member-functions/)) ・~~SwDocやUndoManagerにデータが入っているなら、デバッグの範囲はswディレクトリ内のファイルだけで良いのでは?~~ ・sw/READMEの情報->classだけでなくinterfaceも理解することが大切かも > SwDoc > The central class for a document is SwDoc, which represents a document. > > A lot of the functionality is split out into separate Manager classes, each of which implements some IDocument* interface; there are SwDoc::getIDocument*() methods to retrieve the managers. > > However there are still too many members and methods in this class, many of which could be moved to some Manager or other... ・svl/source/undo/undo.cxx の SfxUndoManager::GetUndoActionCount()などではUndoArrayが見られる ## Day6 (10/20) 気になった関数・変数 SwCursorShell::Push(), Pop() sw/source/core/crsr/crsrsh.cxx スタックにpushしてくれそうだが、execundoだけでなくexecinsertでも呼ばれているので違う? crsrというディレクトリ名や、カーソルを移動しただけで反応するという挙動から、画面上でのカーソルを操る関数だと判断。今後クラスSwCursorShellには近づかないことにする pActUndoArray この配列が大切そう Undo操作をより詳細に見ていった結果、わかったこと。 <details> <summary> Undo操作の全体像 </summary> Day5でもある程度わかったように、Undo操作は、 ``` SwBaseShell::ExceUndo→SwWrtShell::Do→SwEditShell::Undo→UndoManager::UndoWithOffset→UndoManager::impl_DoUndoRedo ``` のような階層で行われている。 ここのうちUndoManager::impl_DoUndoRedoで大事な実装が行われているように見える。このimpl_DoUndoRedoも、より詳細に見ていった結果、最終的にSwUndoInsert::UndoImplでUndoの実行をしているように見えた。 </details> <details> <summary> UndoManager::impl_DoUndoRedoのあとの階層 </summary> Day5でもある程度わかったように、Undo操作は、 ``` SwBaseShell::ExceUndo→SwWrtShell::Do→SwEditShell::Undo→UndoManager::UndoWithOffset→UndoManager::impl_DoUndoRedo ``` のような階層で行われている。 ここのうちUndoManager::impl_DoUndoRedoで大事な実装が行われていて、このimpl_DoUndoRedoも、より詳細に見ていった結果、 ``` UndoManager::impl_DoUndoRedo→SfxUndoManager::UndoWithContext→SfxUndoManager::ImplUndo→SwUndo::UndoWithContext→SwUndoInsert::UndoImpl→SwTextNode::EraseText→sw::BroadcastingModify::CallSwClientNotify→SwModify::CallSwClientNotify→SwTextFrame::SwClientNotify ``` の階層があって、最終的にはSwTextFrame::SwClientNotifyでUndoの実行をしているように見えた。 しかし、このSwTextFrame::SwClientNotify自体も中に入ると様々なことをしているため、より詳細に見ていく必要がある。 </details> <details> <summary> ①UndoManager::impl_DoUndoRedoの動作について </summary> 少し例外的な処理をしたあとに、UndoとRedoで場合分けして、Undoの場合はSfxUndoManager::UndoWithContextに処理を投げている。 </details> <details> <summary> ②SfxUndoManager::UndoWithContextの動作について </summary> 完全にSfxUndoManager::ImplUndoに投げている。 </details> <details> <summary> ➂SfxUndoManager::ImplUndoの動作について </summary> Undoスタックがそもそも空じゃないか見ているためだいぶ怪しい。 また、そのあとにpActionでアクションのポインタをゲットし、次に実際にそのポインタで具体的なAction内容をsActionCommentに取り出している。そしてその後、SwUndo::UndoWithContextを実行している。 </details> <details> <summary> ④SwUndo::UndoWithContextの動作について </summary> 割とすぐにSwUndoInsert::UndoImplに投げている。 </details> <details> <summary> ⑤SwUndoInsert::UndoImplの動作について </summary> いろいろいじった結果、最後にSwTextNode::EraseTextに残りの処理を頼んでいる。 </details> <details> <summary> ⑥SwTextNode::EraseTextの動作について </summary> for文やif文に入らなくて、結局nCntが1かそれ以外(おそらく文字数が1以上かどうか)で分岐してDeleteTextで情報をまとめさせて、それをsw::BroadcastingModify::CallSwClientNotifyに渡してを実行させていた。 </details> <details> <summary> ⑦sw::BroadcastingModify::CallSwClientNotifyの動作について </summary> </details> <details> <summary> ⑧SwModify::CallSwClientNotifyの動作について </summary> </details> <details> <summary> ⑩SwTextFrame::SwClientNotifyの動作について </summary> ここばっか長い。結局pDeleteTextで他と区別して、SwTextFrame::InvalidateRangeを呼び出している。 </details> <details> <summary> ⑪SwTextFrame::InvalidateRangeの動作について </summary> すぐSwTextFrame::InvalidateRange_を呼び出している。 </details> <details> <summary> ⑫SwTextFrame::InvalidateRange_の動作について </summary> 最後にSwFrame::InvalidateSizeを呼び出している。そしてこれはSwFrame::ImplInvalidateSizeを呼び出している。そしてよくわからん。結局どこなんだろ。 </details> <details> <summary> 結果的に関係なさそうだったが得た情報 </summary> Day5で、SwEditShell::UndoとUndoManager::impl_DoUndoRedo が怪しいと判断したが、ここでSwEditShell::Undoについてより深ぼった。具体的には、Day5にはimpl_DoUndoRedoが呼びだれている箇所の他にもUndo操作に深く関わっているように見えた部分があったため、それらについてより深く見ていった。 <details> <summary> GetLastUndoInfo()について </summary> GetLastUndoInfo()という関数は、引数にnLastUndoIdという最後のUndo操作を示すIDをとって、それをもとに直前のUndo操作の情報を返す関数だと理解していたため、この情報をとってくる操作をみることがで実際の文字列などを管理しているスタックへの操作に行き着くのではないのかと思い、調べていった。 結果的に、Undoの操作を格納している箇所などが見つかったが、Undoの操作でその関数が呼び出されていなかったので、これ以上深ぼることをやめた。 </details> <details> <summary> Push()とPop() </summary> 名前からしてスタックにPushし、スタックから要素をPopする操作に思え、ここかもしれないと思い詳細に見ていったが、これはカーソルをうごかすための関数であることがわかった。 </details> </details> </details> ##### これから ・正直Undo操作の構造自体に変更加えるのは不可能だと感じた(いろんな人が編集した結果なのか、動作自体があまりにも複雑すぎる)。よって、なにか別の変更点を考えなければならない。できればUndo関連がいいけど、どうなんだろ。 <details> <summary> 案1 </summary> 案1:Undoボタンの横の矢印をクリックするとプルダウンメニュー?的なので今までの履歴が見えて戻るところが選択できるようになっているが、これを矢印をクリックせず、Undoボタンをhoverするだけで表示されるようにする。 →①OnClick()的なのでプルダウンメニューを開く関数を特定 →②Hoverすると色が変わるので、Hover()的なのでそこを探して、そこに①を入れる </details> <details> <summary> 案2 </summary> 案2:command+Uとかで案1のプルダウンメニューが表示されるようにする。 →①ショートカットの入力操作をどこで処理しているのか特定する。 →②OnClick()的なのでプルダウンメニューを開く関数を特定 →➂プルダウンメニューがカーソルのところに来るようにする。(右クリックとかを参考にする?) </details> <details> <summary> 案3 </summary> 案3:Undo操作自体を、1文字ずつしかUndoできないようにする。 →①nCntとかnLenとかをいつも1に設定しておけばいいのかな?めっちゃ他のところで矛盾でそうだけど </details> ・正直多分意味はないが、個人的に知りたいUndoの動作(実験終わったあとでも) 1. Undo操作の中で、DeleteとAppendの2種類があると思う。それをどこで判断しているのかをしっかり突き止めたい 2. Deleteに関しては、実際にスタックのインデックスを加えたりしているところを正確に特定したい。 3. そもそもおおもとのExecUndoでundo、Redo、Repeatの3種類の操作をIDで識別しているが、そのIDはどこで定義され、入力されたのか(ようは入力からどうRedo,Undo,Repeatを判断したのか)。 →ExecUndoから1つさかのぼったらworkdir/SdiTarget/sw/sdi/swslots.hxxの2171にきた。 →sfx2/sdi/sfx.sdiの4521行目がSID_UNDO(5701)の定義? <details> <summary> 案4 </summary> 一度のUndoで10個など大幅に戻る・進むができるようにする。1文字ずつのUndoが出来ればその延長でできるかも。 </details> <details> <summary> 案5(Undoではなくカーソル関係だけど) </summary> カーソルを行の左端を選択している状態でCtrl+Cを押すと勝手に行全体がコピーされるようにする。確かVSCodeなどでは既に存在している機能。 </details> memo UndoManager::AppendUndo->?->SfxUndoManager::AddUndoAction->SfxUndoManager::ImplAddUndoAction_NoNotify->SfxUndoArray::Insert-> とりあえず: 案1がんばる。 メモ: ・vcl/unx/gtk3/gtkdata.cxxのGtkSalData::Yieldで常時入力を受け付けている。 ・vcl/source/window/toolbox.cxxでToolBox::MouseButtonDownとかMouseMoveとかいろいろマウス関連がある。ToolBox::MouseMoveはカーソルが何かのボタンとかに来たときに反応する。 ・framework/source/uielement/toolbarmanager.cxxにIMPL_LINK_NOARGとか謎のがある。 ・svtools/source/uno/toolboxcontroller.cxxにToolboxController::clickとかある。 メモ2 ・ImplHandleMouseEvent->ToolBox::MouseMove ・画面上のUndo右の矢印をクリックしたとき IMPL_LINK_NOARG =>Reference<awt::XWindow>SAL_CALLPopupWindowController::createPopupWindow =>VclPtr<vcl::Window>SvxUndoRedoControl::createVclPopupWindow ①->SvxUndoRedoControl::SetInfo ->SetText ->SvxUndoRedoControl::SetText ->DockingWindow::SetText ->Window::SetText ②->show createPopupWindow(svtools/source/uno/popupwindowcontroller.cxx) SvxUndoRedoControl::SetInfo(svx/source/tbxctrls/lboxctrl.cxx l106) Reference<awt::XWindow>SAL_CALLPopupWindowController::createPopupWindowkからステップアウトしてさらに外側の関数OnDropdownClick(framework/source/uielement/toolbarmanager.cxx)へ移動すると1780行目でフリーズする (パソコンの不調) ビルドした当初は問題なくデバッグできていたが、10/21当たりから実行すると途中でフリーズして動かなくなることが多くなった。画面は動くが、マウスやキーボードからの入力を受け付けない状態。PCを強制的に再起動すると復活する。 # Day7 (10/24) vcl/source/window/toolbox.cxxのToolBox::MouseMove関数の中身の3105行目でどのボタンにマウスがあるのか判別している。 vcl/source/window/toolbox.cxxのToolBox::MouseButtonDown関数の中身の3200行目でどのボタンが押されたか判別している。 やりたいこと: ToolBox::MouseMove関数内で、Undoボタンが識別されたら(25)、if文でToolBox::MouseButtonDownを実行させる(return文で) その前にButtonDown関数の中で正しいif文の中に入るためにrMEvt.IsLeft()がTrueとなるように変更させる。→rMEvt.mnCodeを0から1に変更すればいい。 mnClicksも0から1に変更 実際の変更トライ1 MouseEvent のメンバ変数 mnClicks, mnCodeをprivateからpublic(include/vcl/event.hxx) ->失敗。引数としていた構造体が上書きできなかったため。 実際の変更トライ2 ①ToolBox::MouseButtonDown2を、vcl/source/window/toolbox.cxx内のMouseButtonDownをコピーして作成。このMouseButtonDown2のrMEvt.IsLeft()を削除。そして、同じファイルのMouseMove関数内の `if ( (item.meType == ToolBoxItemType::BUTTON) && item.mbEnabled )` のすぐ下に、 ``` if (nTempPos == 25) { return this->MouseButtonDown2( rMEvt ); } ``` を加えた。 ②include/vcl/toolbox.hxxの272行目の ``` void MouseButtonDown2( const MouseEvent& rMEvt ); ``` を付け加えた。 これからなにをするか: ・ホバーリングしたときに、クリックしたときのようにアイコンの色が変わり、他のボタンが押せなくなる原因を突き止めて治す → ・あともーーーしできればホバーリングしたときに出てくる黒い説明ウィンドー的なのも消したい。時間があれば。 ・ホバーリングしてメニューを出した後、現状では別の場所をクリックするまでそのメニューが出続けるが、それをカーソルがアイコンを離れた瞬間に消えるようにする ・vcl/source/window/winproc.cxxのImplHandleMouseEventとImplWindowFrameProc ## Day8 MoveMouse 3102行目 if ( !rMEvt.IsLeaveWindow() && (mnCurPos == ITEM_NOTFOUND) ) IsLeaveWindow()によってカーソルがアイコンを外れたのを確認している? 定義 bool IsLeaveWindow() const { return bool(mnMode & MouseEventModifiers::LEAVEWINDOW); } Undoなど、ボタン右の矢印を押したときに出るメニューを消すタイミング: vcl/source/window/toolbox.cxxのMouseMove内の3111あたりで 次知りたいのは、クリックしたときにドロップダウンウィンドーが閉じられる関数がどれかを特定。 CPPFLAGS="-I /home/.." ./autogen ... はろ はろー https://freepc.jp/post-43215 ## Day9 ブログの内

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully