Dictionary Patch 2

This post is outdated. See the following for update. Dictionary Patch 3

Goal

To replace Eudic with GoldenDict for better responding speed, better extensibility, better and more flexible UI, free of charge, and less stability issues.
  • [x] Find a good Dictionary
    • [x] Modify for better user experience
  • [x] FInd a good Dictionary Software
    • [x] Modify for better user experience
    • [x] FInd a even better Dictionary Software and modify it for good
  • [x] Integrate with Shanbay
    • [x] Basic intergration by simulating user activity
    • [ ] Advanced intergration by combining webpage with local software

Dictionary

See Dictionary Patch

Dictionary Software

GoldenDict

Source Code

https://github.com/goldendict/goldendict

Release

https://sourceforge.net/projects/goldendict/files/early%20access%20builds/Qt5-based/64bit/

Style

GoldenDict uses web-kit for core content display and QT for UI frame. Both use css for styling. Set Display style as Babylon in Preference and have the following css deployed under working directory:

article-style.css

body {
    margin: 1.25em 1.5em 1em 0.7em;
}

.gdarticle * {
    font-family: "Microsoft Yahei";
    line-height: 1.8em;
}

.gddicticon {
    display: none;
}

.gddictname {
    border-top-left-radius: 0;
}

qt-style.css

MainWindow
{
    background: #ffffff;
}

MainWindow #searchPane #translateLine, MainWindow #searchPane #wordList
{
    background: #f0eded;
    padding-left: 0.1em;
}

MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList
{
    background: #ffffff;
    border: none;
    margin: 6px;
}

* {
    font-family: "Microsoft Yahei";
}

MainWindow #tabWidget{
    border-width:0px;
}

Fast Search Script

; To SZL, with best wishes
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#if WinActive("扇贝,知道你在改变 - Google Chrome")
    ~LButton::
        ;Test Drag
        CoordMode, Mouse, Screen
        MouseGetPos, x1, y1
        KeyWait, LButton, Up
        MouseGetPos, x2, y2
        if (abs(x1-x2)>0 or abs(y1-y2)>0)
        {
            Gosub, CallGoldenDict
            return
        }
        ;Test Double Click
        else if (A_PriorHotkey = "~LButton" and A_TimeSincePriorHotkey < 300)
        {
            Gosub, CallGoldenDict
            return
        }
        return
    Space::
        Send {Tab}
        Loop {
            PixelSearch, Px, Py, 170, 225, 1080, 400, 0x333333, 0, Fast
            PixelSearch, Px2, Py2, Px, Py+1, Px, Py+1, 0x333333, 0, Fast
            if A_TimeSinceThisHotkey > 1000
            {
                return
            }
        } Until ErrorLevel = 0
        MouseClick, left, Max(Px2-50,280), Py2
        MouseClick, left, Max(Px2-50,280), Py2
#if


CallGoldenDict:
Send {LControl down}{c down}{c up}
Sleep, 10
Send {c down}{c up}{LControl up}
Sleep, 10
WinActivate, 扇贝,知道你在改变 - Google Chrome